Boundary on "CASE WHEN" does not what i expect

Hi!
The results of query1 are exactly what i expect but when i compare the counts with CASE WHEN (query2) then i get double records where the count is exactly 8. The value of Result on the second record becomes Null. This seems to me somewhat strange.
Any suggestion?
query1:
SELECT DISTINCT inline_view.u_plot_number AS Research_Group,
       inline_view.external_reference AS Parental_Line,
       inline_view.u_box_code AS Box,
       inline_view.description AS Test,
       COUNT(NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
          OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) AS R1,
       COUNT(DISTINCT NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
          OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) AS R2
FROM ( SELECT DISTINCT sdg.sdg_id,
              sample.sample_id,
              test_template.test_template_id,
              sample_user.u_plot_number,
              sdg.external_reference,
              sample_user.u_box_code,
              test.description
       FROM sdg,sdg_user,sample,sample_user,aliquot,test,test_template
       WHERE sdg.sdg_id = sdg_user.sdg_id
          AND sdg.sdg_id = sample.sdg_id
          AND sample.sample_id = sample_user.sample_id
          AND aliquot.sample_id = sample.sample_id
          AND test.aliquot_id = aliquot.aliquot_id
          AND test_template.test_template_id = test.test_template_id
          AND sdg.sdg_id >505
     ) inline_view,
     ( SELECT DISTINCT u_finalresult_user.u_sdg_id,
              u_finalresult_user.u_calculated_result,
              u_finalresult_user.u_overruled_result,
              u_finalresult_user.u_sample_id,
              u_finalresult_user.u_test_template_id
       FROM u_finalresult_user
       WHERE u_finalresult_user.u_requested = 'T'
     ) inline_view_finalresult
WHERE inline_view.sample_id = inline_view_finalresult.u_sample_id (+)
   AND inline_view.test_template_id = inline_view_finalresult.u_test_template_id (+)
ORDER BY inline_view.description,inline_view.u_box_codequery2:
SELECT DISTINCT inline_view.u_plot_number AS Research_Group,
       inline_view.external_reference AS Parental_Line,
       inline_view.u_box_code AS Box,
       inline_view.description AS Test,
       CASE WHEN
            COUNT(NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
            OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) < 8
         THEN
            'onv'
         ELSE
            CASE WHEN
                   COUNT(DISTINCT(NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result)))
                   OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) > 1
                 THEN
                   'spl'
                 ELSE
                  NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result)
            END
      END AS Result
FROM ( SELECT DISTINCT sdg.sdg_id,
              sample.sample_id,
              test_template.test_template_id,
              sample_user.u_plot_number,
              sdg.external_reference,
              sample_user.u_box_code,
              test.description
       FROM sdg,sdg_user,sample,sample_user,aliquot,test,test_template
       WHERE sdg.sdg_id = sdg_user.sdg_id
          AND sdg.sdg_id = sample.sdg_id
          AND sample.sample_id = sample_user.sample_id
          AND aliquot.sample_id = sample.sample_id
          AND test.aliquot_id = aliquot.aliquot_id
          AND test_template.test_template_id = test.test_template_id
          AND sdg.sdg_id >505
     ) inline_view,
     ( SELECT DISTINCT u_finalresult_user.u_sdg_id,
              u_finalresult_user.u_calculated_result,
              u_finalresult_user.u_overruled_result,
              u_finalresult_user.u_sample_id,
              u_finalresult_user.u_test_template_id
       FROM u_finalresult_user
       WHERE u_finalresult_user.u_requested = 'T'
     ) inline_view_finalresult
WHERE inline_view.sample_id = inline_view_finalresult.u_sample_id (+)
   AND inline_view.test_template_id = inline_view_finalresult.u_test_template_id (+)
ORDER BY inline_view.description,inline_view.u_box_code

NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result)does not return double records without the CASE WHEN (see below) but i don't understand why it comes that when i compares the counts in a CASE WHEN that i get double records where the second record has value Null as Result. Could somebody provide me with a solution?
SELECT DISTINCT inline_view.u_plot_number AS Research_Group,
       inline_view.external_reference AS Parental_Line,
       inline_view.u_box_code AS Box,
       inline_view.description AS Test,
       COUNT(NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
          OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) AS R1,
       COUNT(DISTINCT NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result))
          OVER (PARTITION BY CONCAT(inline_view_finalresult.u_sdg_id,inline_view_finalresult.u_test_template_id)) AS R2,
NVL(inline_view_finalresult.u_overruled_result,inline_view_finalresult.u_calculated_result) AS Result
FROM ( SELECT DISTINCT sdg.sdg_id,
              sample.sample_id,
              test_template.test_template_id,
              sample_user.u_plot_number,
              sdg.external_reference,
              sample_user.u_box_code,
              test.description
       FROM sdg,sdg_user,sample,sample_user,aliquot,test,test_template
       WHERE sdg.sdg_id = sdg_user.sdg_id
          AND sdg.sdg_id = sample.sdg_id
          AND sample.sample_id = sample_user.sample_id
          AND aliquot.sample_id = sample.sample_id
          AND test.aliquot_id = aliquot.aliquot_id
          AND test_template.test_template_id = test.test_template_id
          AND sdg.sdg_id >505
     ) inline_view,
     ( SELECT DISTINCT u_finalresult_user.u_sdg_id,
              u_finalresult_user.u_calculated_result,
              u_finalresult_user.u_overruled_result,
              u_finalresult_user.u_sample_id,
              u_finalresult_user.u_test_template_id
       FROM u_finalresult_user
       WHERE u_finalresult_user.u_requested = 'T'
     ) inline_view_finalresult
WHERE inline_view.sample_id = inline_view_finalresult.u_sample_id (+)
   AND inline_view.test_template_id = inline_view_finalresult.u_test_template_id (+)
ORDER BY inline_view.description,inline_view.u_box_code

Similar Messages

  • Silverlight 5 binding on a property with logic in its setter does not work as expected when debug is attached

    My problem is pretty easy to reproduce.
    I created a project from scratch with a view model.
    As you can see in the setter of "Age" property I have a simple logic.
        public class MainViewModel : INotifyPropertyChanged
                public event PropertyChangedEventHandler PropertyChanged;
                private int age;
                public int Age
                    get
                        return age;
                    set
                        /*Age has to be over 18* - a simple condition in the setter*/
                        age = value;
                        if(age <= 18)
                            age = 18;
                        OnPropertyChanged("Age");
                public MainViewModel(int age)
                    this.Age = age;
                private void OnPropertyChanged(string propertyName)
                    if (this.PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    In the MainPage.xaml 
         <Grid x:Name="LayoutRoot" Background="White">
                <TextBox 
                    Text="{Binding Path=Age, Mode=TwoWay}" 
                    HorizontalAlignment="Left"
                    Width="100"
                    Height="25"/>
                <TextBlock
                    Text="{Binding Path=Age, Mode=OneWay}"
                    HorizontalAlignment="Right"
                    Width="100"
                    Height="25"/>
            </Grid>
    And MainPage.xaml.cs I simply instantiate the view model and set it as a DataContext.
        public partial class MainPage : UserControl
            private MainViewModel mvm;
            public MainPage()
                InitializeComponent();
                mvm = new MainViewModel(20);
                this.DataContext = mvm;
    I expect that this code will limit set the Age to 18 if the value entered in the TextBox is lower than 18.
    Scenario: Insert into TextBox the value "5" and press tab (for the binding the take effect, TextBox needs to lose the focus)
    Case 1: Debugger is attached =>
    TextBox value will be "5" and TextBlock value will be "18" as expected. - WRONG
    Case 2: Debugger is NOT attached => 
    TextBox value will be "18" and TextBlock value will be "18" - CORRECT
    It seems that when debugger is attached the binding does not work as expected on the object that triggered the update of the property value. This happens only if the property to which we are binding has some logic into the setter or getter.
    Has something changed in SL5 and logic in setters is not allowed anymore?
    Configuration:
    VisualStudio 2010 SP1
    SL 5 Tools 5.1.30214.0
    SL5 sdk 5.0.61118.0
    IE 10
    Thanks!                                       

    Inputting the value and changing it straight away is relatively rare.
    Very few people are now using Silverlight because it's kind of deprecated...
    This is why nobody has reported this.
    I certainly never noticed this problem and I have a number of live Silverlight systems out there.
    Some of which are huge.
    If you want a "fix":
    private void OnPropertyChanged(string propertyName)
    if (this.PropertyChanged != null)
    //PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    Storyboard sb = new Storyboard();
    sb.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 100));
    sb.Completed += delegate
    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    sb.Begin();
    The fact this works is interesting because (I think ) it means the textbox can't be updated at the point the propertychanged is raised.
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • Hello my name is Omar Andres Santacruz, finished iMedicalOffice buy a program you have in the app store but what he said on the page is not what I expected, I was very disappointed that, frustrated and reweighed when I check my account had gained 139.99 f

    Hello my name is Omar Andres Santacruz, finished iMedicalOffice buy a program you have in the app store but what he said on the page is not what I expected, I was verydisappointed that, frustrated and reweighed when I check my account had gained139.99 for 7 times, I do not understand what has happened that is not the first time I buy something ustedeses thank you very much for your help

    Wow, Karan Taneja, you've just embarrassed yourself on a worldwide support forum.  Not only is your post ridiculous and completely inappropriate for a technical support forum, but it also shows your ignorance as to whom you think the audience is.  Apple is not here.  It's users, like you. 
    If you would have spent half the time actually reading the Terms of Use of this forum that YOU agreed to by signing up to post, as you did composing that usesless, inappropriate post, you (and the rest of us on this forum) would have been much better off.

  • Jewel case insert does not print properly since new itunes version was installed

    jewel case insert does not print properly since new itunes version was installed. The song list prints all of the line items too close together without space inbetween each song.

    I am having the same issue. If I close itunes and open with a new CD already in the drive, it will find it. But once that CD has been imported and ejected, itunes does not find the newly inserted CD and there is no command to tell itunes to "look" in the CD drive

  • Upper case "s" does not work in most programs

    Upper case "s" does not work in a number of programs, lower case is fine. It is the only letter that is missing in both cases.
    Any ideas. Do I need to reinstall driver for keyboard? If so any idea where to get it.

    Open the Speech pane of System Preferences and check whether either the listening key or the speech key has become set to that keystroke; if so, change the setting.
    (41135)

  • The declared package does not match the expected package

    I was given some Java code that I need to get working and then make some improvements on, but I'm still in the process of learning Java and the IDE Eclipse as well. There is a package called MyGUI and most of the files in that package had the error "The declared package MyGui does not match the expected package MyGUI" as a result of the inconsistent case, so I changed all of the first lines "package MyGui" to "package MyGUI" and this fixed all of those problems except for one.
    There is still one file where it gives this error message even though I changed the code the same way I did for the other files. I can't figure why this file is different. I saved it and I also refreshed everything, but it still gives me the error message "The declared package MyGui does not match the expected package MyGUI" although the package is clearly declared as "MyGUI".
    Does anyone have an idea of why this would be? I am very new to Eclipse and Java, so I don't really know how to go about solving errors yet.

    Forget the IDE until you get a handle on basic concepts like packages and classpath.
    The error you're talking about comes when a .java or .class file is not in a directory that matches its declared package.
    Let's say that CLASSPATH_ROOT is the only element in your classpath. If you have a class that is declared like so:
    package com.foo;
    class Bar {}Then, you must have CLASSPATH_ROOT/com/foo/Bar.java or CLASSPATH_ROOT/com/foo/Bar.class.
    The language rules for .java files are not as strict as those for .class files, but some compilers may expect them to be the same, and it's a good idea to do so even if it's not strictly necessary, for clarity's sake.
    Also, even though Windows' file system is not case sensitive--that is it considers FOO.class and foo.class the same file name--Java is. You probably can't directly rename FOO.java to Foo.java in Windows, as it will say it's the same name, so if you need to change the case, rename it to a different name, than back to Foo with the correct case.
    Edited by: jverd on Mar 29, 2009 12:07 PM

  • The publisher in the uploaded package does not match the expected publisher.

    I have an existing Windows Phone 8 application in which I wish to release an update to. This update includes new features as well as targets the 8.1 platform. Because of an unknown problem with the original Visual Studio project
    where the app stopped being able to be deployed to test devices, it was faster to create a new Visual Studio project and copy over the existing code and assets than try and find the issue in the original project. This lead to the publisher GUIDs being different
    between the new and original projects.  
    Now when I try and submit the updated package within the Windows Phone Online dashboard I get the following error message "The publisher in the uploaded package does not match the expected publisher. The expected publisher
    for this app is: "CN=0745C81D-D1ED-49ED-A219-C546B5F31DE5"".
    I have updated both the WMAppManifest and Package.appxmanifest so that they have the following attributes and information:
    Package.appxmanifest (PhonePublisherId="0745C81D-D1ED-49ED-A219-C546B5F31DE5")
    And
    WMAppManifest (PublisherID="{0745C81D-D1ED-49ED-A219-C546B5F31DE5})
     I have then recompiled the app and uploaded and attempted to resubmit the update but I still get the error that the Publisher does not match. What have I missed??

    This sounds tricky... perhaps you can do a search in the entire app for the GUIDs and replace them.
    Also, you could build the appx package, rename the .appx to .zip, and open it up to see if you can find the wrong publisher id anywhere and it might give you a clue to where to make the change.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Eclipse error : The declared package does not match the expected package

    I'm trying to setup an Eclipse project on some existing code but I can't get past this error. The source files are in the following directories:
    d:\mycompany\coolstuff
    d:\mycompany\neatstuff
    The source files in the coolstuff directory have a package statement:
    package mycompay.coolstuff
    The source files in the neatstuff directory have a package statement:
    package mycompany.neatstuff
    I create a new Eclipse Java project, specify the existing directoy of d:\mycompany. When Eclipse tries to build, it gives the following error:
    The declared package "mycompany.coolstuff" does not match the expected package "coolstuff"
    I've tried everything I can think of short of modifying every package statement since they seem correct based on the Java documentation. What am I missing?

    All the source builds just fine using a command
    nd line and a classpath=.\That's meaningless, since classpath=.\ is just setting the classpath to the current directory.
    d:\mycompany\coolstuff
    d:\mycompany\neatstuff
    The source files in the coolstuff directory have a
    package statement:
    package mycompay.coolstuff
    The source files in the neatstuff directory have a
    package statement:
    package mycompany.neatstuff
    I create a new Eclipse Java project, specify the
    existing directoy of d:\mycompany.When you use the package statement "package mycompay.coolstuff" Eclipse looks in the directory above mycompany for mycompay\coolstuff\<classname>, and that directory is d:\, not d:\mycompany.
    When Eclipse
    tries to build, it gives the following error:
    The declared package "mycompany.coolstuff" does not
    match the expected package "coolstuff"

  • Compiles but does not execute as expected????

    Here is my code. I can compile and execute but does not perform as expected What do I need to change?
    import java.io.;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import java.math.*;
    public class CalcTest extends JFrame implements ActionListener, ItemListener
    public JMenuBar createMenuBar()
            JMenuBar mnuBar = new JMenuBar();
            setJMenuBar(mnuBar);
                //Create File & add Exit
            JMenu mnuFile = new JMenu("File", true);
            mnuFile.setMnemonic(KeyEvent.VK_F);
            mnuFile.setDisplayedMnemonicIndex(0);
            mnuBar.add(mnuFile);
            JMenuItem mnuFileExit = new JMenuItem("Exit");
            mnuFileExit.setMnemonic(KeyEvent.VK_F);
            mnuFileExit.setDisplayedMnemonicIndex(1);
            mnuFile.add(mnuFileExit);
            mnuFileExit.setActionCommand("Exit");
            mnuFileExit.addActionListener(this);
            JMenu mnuFunction = new JMenu("Function", true);
            mnuFunction.setMnemonic(KeyEvent.VK_F);
            mnuFunction.setDisplayedMnemonicIndex(0);
            mnuBar.add(mnuFunction);
           JMenuItem mnuFunctionClear = new JMenuItem("Clear");
           mnuFunctionClear.setMnemonic(KeyEvent.VK_F);
           mnuFunctionClear.setDisplayedMnemonicIndex(1);
           mnuFunction.add(mnuFunctionClear);
           mnuFunctionClear.setActionCommand("Clear");
           mnuFunctionClear.addActionListener(this);
            // Fields for Principle 
      JPanel row1 = new JPanel();
      JLabel dollar = new JLabel("How much are you borrowing?"); 
      JTextField money = new JTextField("", 15);
            // Fields for Term and Rate
       JPanel row2 = new JPanel();
       JLabel choice = new JLabel("Select Year & Rate:");
       JCheckBox altchoice = new JCheckBox("Alt. Method");
       JTextField YR = new JTextField("", 4);
       JTextField RT = new JTextField("", 4);
           //Jcombobox R=rate,Y=year
       String[] RY =  {   
            "7 years at 5.35%", "15 years at 5.5 %", "30 years at 5.75%", " "  
      JComboBox mortgage = new JComboBox(RY);
                // Fields for Payment   
        JPanel row3 = new JPanel(); 
        JLabel payment = new JLabel("Your monthly payment will be:");
        JTextField owe = new JTextField(" ", 15); 
              //Scroll Pane and Text Area
       JPanel row4 = new JPanel();
       JLabel amortization = new JLabel("Amortization:");
       JTextArea chart = new JTextArea(" ", 7, 22); 
       JScrollPane scroll = new JScrollPane(chart, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,  
                                               JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);  
        StringBuffer amt = new StringBuffer();
        Container pane = getContentPane(); 
        FlowLayout flow = new FlowLayout(FlowLayout.LEFT);
        JButton Cal = new JButton("Calculate"); 
        NumberFormat currency = NumberFormat.getCurrencyInstance();  
      public CalcTest() 
               // Title and Exit of JFrame  
         super("Mortgage and Amortization Calculator"); 
         setSize(475, 328);  
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
                //JFrame layout      
         pane.setLayout(flow);     
               //Input output fields added to JFrame  
         row1.add(dollar);    
         row1.add(money);   
         pane.add(row1);    
         mortgage.setSelectedIndex(3);   
         mortgage.addActionListener(this);    
         mortgage.setActionCommand("mortgage");
         row2.add(altchoice);     
         altchoice.addItemListener(this);  
         row2.add(choice);     
         YR.setEditable(false);    
         RT.setEditable(false);     
         row2.add(YR);     
         row2.add(RT);      
         row2.add(mortgage);    
         pane.add(row2);     
         row3.add(payment);   
         row3.add(owe);       
         pane.add(row3);      
         owe.setEditable(false);  
                 //Scroll Pane added to JFrame     
          row4.add(amortization);      
          chart.setEditable(false); 
          row4.add(scroll);   
          pane.add(row4);     
                //Executable Button- Clear,Exit, Calculate 
          JPanel row5 = new JPanel();
          JButton clear = new JButton("Clear");  
          clear.addActionListener(this);     
          row5.add(clear); 
          pane.add(row5); 
          JButton exit = new JButton("Exit"); 
          exit.addActionListener(this);    
          row5.add(exit);      
          Cal.setEnabled(false);  
          Cal.addActionListener(this); 
          row5.add(Cal);       
          pane.add(row5);   
          setContentPane(pane);   
          setVisible(true); 
      }                    //End of constructor   
        private void calculate()
          String loanAmount = money.getText(); 
             if(loanAmount.equals(""))      
               return;      
               double P = Double.parseDouble(loanAmount);     
               int y;     
               double r;    
             if(altchoice.isSelected())   
              if(YR.getText().equals("") || RT.getText().equals(""))  
                 return;        
               y = Integer.parseInt(YR.getText());     
                r = Double.parseDouble(RT.getText());   
               else     
                  int index = mortgage.getSelectedIndex();  
                  if(index == 3)         
                  return;          
                  int[] terms = { 7, 15, 30 };     
                  double[] rates = { 5.5, 5.35, 5.75 }; 
                  y = terms[index];  
                  r = rates[index];  
                  double In = r / (100 * 12.0);  
                  double M = P * (In / (1 - Math.pow(In + 1, -12.0 * y)));
                  owe.setText(currency.format(M));      
                         //Column Titles for Text Area     
           chart.setText("Pmt#\tPrincipal\tInterest\tBalance\n");  
         for (int i = 0; i < y * 12; i++)     
      {            double interestAccrued = P * In;     
                   double principalPaid = M - interestAccrued;          
                   chart.append(i + 1 + "\t" + currency.format(principalPaid)           
                                    + "\t" + currency.format(interestAccrued)     
                                          + "\t" + currency.format(P) + "\n");      
                    P = P + interestAccrued - M;   
         public void itemStateChanged(ItemEvent ie) 
      {        int status = ie.getStateChange();    
           if (status == ItemEvent.SELECTED)     
               mortgage.setEnabled(false);  
               YR.setEditable(true); 
               RT.setEditable(true);   
               Cal.setEnabled(true);  
            else 
            mortgage.setEnabled(true); 
            YR.setEditable(false);    
            RT.setEditable(false);     
           Cal.setEnabled(false);     
      public void actionPerformed(ActionEvent ae)//Calculations and Button executions
          String command = ae.getActionCommand();  
                  // Exit program      
           if (command.equals("Exit"))   
            System.exit(0);
                  // Cal button 
          if (command.equals("Calculate") || command.equals("mortgage")) 
              calculate();      
                 // Clear fields  
          if (command.equals("Clear")) 
             money.setText(null);
             mortgage.setSelectedIndex(3); 
             owe.setText(null);   
             chart.setText(null); 
    }             //End actionPerformed 
       public static void main(String args[]) throws IOException
               new CalcTest();
    [/Code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Here is the code again
    import java.io.;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import java.math.*;
    public class CalcTest extends JFrame implements ActionListener, ItemListener
    public JMenuBar createMenuBar()
            JMenuBar mnuBar = new JMenuBar();
            setJMenuBar(mnuBar);
                //Create File & add Exit
            JMenu mnuFile = new JMenu("File", true);
            mnuFile.setMnemonic(KeyEvent.VK_F);
            mnuFile.setDisplayedMnemonicIndex(0);
            mnuBar.add(mnuFile);
            JMenuItem mnuFileExit = new JMenuItem("Exit");
            mnuFileExit.setMnemonic(KeyEvent.VK_F);
            mnuFileExit.setDisplayedMnemonicIndex(1);
            mnuFile.add(mnuFileExit);
            mnuFileExit.setActionCommand("Exit");
            mnuFileExit.addActionListener(this);
            JMenu mnuFunction = new JMenu("Function", true);
            mnuFunction.setMnemonic(KeyEvent.VK_F);
            mnuFunction.setDisplayedMnemonicIndex(0);
            mnuBar.add(mnuFunction);
           JMenuItem mnuFunctionClear = new JMenuItem("Clear");
           mnuFunctionClear.setMnemonic(KeyEvent.VK_F);
           mnuFunctionClear.setDisplayedMnemonicIndex(1);
           mnuFunction.add(mnuFunctionClear);
           mnuFunctionClear.setActionCommand("Clear");
           mnuFunctionClear.addActionListener(this);
            // Fields for Principle 
      JPanel row1 = new JPanel();
      JLabel dollar = new JLabel("How much are you borrowing?"); 
      JTextField money = new JTextField("", 15);
            // Fields for Term and Rate
       JPanel row2 = new JPanel();
       JLabel choice = new JLabel("Select Year & Rate:");
       JCheckBox altchoice = new JCheckBox("Alt. Method");
       JTextField YR = new JTextField("", 4);
       JTextField RT = new JTextField("", 4);
           //Jcombobox R=rate,Y=year
       String[] RY =  {   
            "7 years at 5.35%", "15 years at 5.5 %", "30 years at 5.75%", " "  
      JComboBox mortgage = new JComboBox(RY);
                // Fields for Payment   
        JPanel row3 = new JPanel(); 
        JLabel payment = new JLabel("Your monthly payment will be:");
        JTextField owe = new JTextField(" ", 15); 
              //Scroll Pane and Text Area
       JPanel row4 = new JPanel();
       JLabel amortization = new JLabel("Amortization:");
       JTextArea chart = new JTextArea(" ", 7, 22); 
       JScrollPane scroll = new JScrollPane(chart, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,  
                                               JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);  
        StringBuffer amt = new StringBuffer();
        Container pane = getContentPane(); 
        FlowLayout flow = new FlowLayout(FlowLayout.LEFT);
        JButton Cal = new JButton("Calculate"); 
        NumberFormat currency = NumberFormat.getCurrencyInstance();  
      public CalcTest() 
               // Title and Exit of JFrame  
         super("Mortgage and Amortization Calculator"); 
         setSize(475, 328);  
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
                //JFrame layout      
         pane.setLayout(flow);     
               //Input output fields added to JFrame  
         row1.add(dollar);    
         row1.add(money);   
         pane.add(row1);    
         mortgage.setSelectedIndex(3);   
         mortgage.addActionListener(this);    
         mortgage.setActionCommand("mortgage");
         row2.add(altchoice);     
         altchoice.addItemListener(this);  
         row2.add(choice);     
         YR.setEditable(false);    
         RT.setEditable(false);     
         row2.add(YR);     
         row2.add(RT);      
         row2.add(mortgage);    
         pane.add(row2);     
         row3.add(payment);   
         row3.add(owe);       
         pane.add(row3);      
         owe.setEditable(false);  
                 //Scroll Pane added to JFrame     
          row4.add(amortization);      
          chart.setEditable(false); 
          row4.add(scroll);   
          pane.add(row4);     
                //Executable Button- Clear,Exit, Calculate 
          JPanel row5 = new JPanel();
          JButton clear = new JButton("Clear");  
          clear.addActionListener(this);     
          row5.add(clear); 
          pane.add(row5); 
          JButton exit = new JButton("Exit"); 
          exit.addActionListener(this);    
          row5.add(exit);      
          Cal.setEnabled(false);  
          Cal.addActionListener(this); 
          row5.add(Cal);       
          pane.add(row5);   
          setContentPane(pane);   
          setVisible(true); 
      }                    //End of constructor   
        private void calculate()
          String loanAmount = money.getText(); 
             if(loanAmount.equals(""))      
               return;      
               double P = Double.parseDouble(loanAmount);     
               int y;     
               double r;    
             if(altchoice.isSelected())   
              if(YR.getText().equals("") || RT.getText().equals(""))  
                 return;        
               y = Integer.parseInt(YR.getText());     
                r = Double.parseDouble(RT.getText());   
               else     
                  int index = mortgage.getSelectedIndex();  
                  if(index == 3)         
                  return;          
                  int[] terms = { 7, 15, 30 };     
                  double[] rates = { 5.5, 5.35, 5.75 }; 
                  y = terms[index];  
                  r = rates[index];  
                  double In = r / (100 * 12.0);  
                  double M = P * (In / (1 - Math.pow(In + 1, -12.0 * y)));
                  owe.setText(currency.format(M));      
                         //Column Titles for Text Area     
           chart.setText("Pmt#\tPrincipal\tInterest\tBalance\n");  
         for (int i = 0; i < y * 12; i++)     
      {            double interestAccrued = P * In;     
                   double principalPaid = M - interestAccrued;          
                   chart.append(i + 1 + "\t" + currency.format(principalPaid)           
                                    + "\t" + currency.format(interestAccrued)     
                                          + "\t" + currency.format(P) + "\n");      
                    P = P + interestAccrued - M;   
         public void itemStateChanged(ItemEvent ie) 
      {        int status = ie.getStateChange();    
           if (status == ItemEvent.SELECTED)     
               mortgage.setEnabled(false);  
               YR.setEditable(true); 
               RT.setEditable(true);   
               Cal.setEnabled(true);  
            else 
            mortgage.setEnabled(true); 
            YR.setEditable(false);    
            RT.setEditable(false);     
           Cal.setEnabled(false);     
      public void actionPerformed(ActionEvent ae)//Calculations and Button executions
          String command = ae.getActionCommand();  
                  // Exit program      
           if (command.equals("Exit"))   
            System.exit(0);
                  // Cal button 
          if (command.equals("Calculate") || command.equals("mortgage")) 
              calculate();      
                 // Clear fields  
          if (command.equals("Clear")) 
             money.setText(null);
             mortgage.setSelectedIndex(3); 
             owe.setText(null);   
             chart.setText(null); 
    }             //End actionPerformed 
       public static void main(String args[]) throws IOException
               new CalcTest();

  • The publisher of the uploaded package does not match the expected publisher . The publisher for this app is expected

    I have a Windows Phone Silverlight 8.1 project that i am trying to publish
    The publisher in the uploaded package does not match the
    expected publisher. The expected publisher for this app is: "CN=00000000-8F5B-44B4-BFC6-F16FB18F2358"
    I have the same Publisher Id set in the WMAppManifest file
    help me 
    thank you 

    Hi kadir u,
    >>The publisher in the uploaded package does not match the expected publisher. The expected publisher for this app is: "CN=00000000-8F5B-44B4-BFC6-F16FB18F2358"
    Based on the error information, we can see that the publisher value does not have the correct one. So please try to open the Package.appxmanifest, then modify the Publisher as "CN=00000000-8F5B-44B4-BFC6-F16FB18F2358":
    <Identity Name="*******"
    Publisher="CN=00000000-8F5B-44B4-BFC6-F16FB18F2358"
    Version="1.0.0.0" />
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • PickList Update - Input values [...] does not match with expected class names

    Hi everybody!
    I try to update a picklist via b1if but I always get the following error-message:
    Exception : Input values '["3" , "3"]' does not match with expected class names '["com.sap.smb.sbo.api.ICompany" , "java.lang.Integer"]' for SBO object type '156'
    As you can see in the error-message I use object type 156 “PickLists”.
    Below you can see the message to the B1 Object – atom:
    <Payload id="atom1" Role="X">
        <System xmlns="">0010000100</System>
        <QueryParams xmlns="">
            <AbsoluteEntry>3</AbsoluteEntry>
        </QueryParams>
        <PickLists xmlns="">
            <row>
                <PickDate>20120914</PickDate>
            </row>
        </PickLists>
        <PickLists_Lines xmlns="">
            <row>
                <OrderEntry>248</OrderEntry>
                <OrderRowID>0</OrderRowID>
                <PickedQuantity>1</PickedQuantity>
            </row>
        </PickLists_Lines>
    </Payload>
    …and the result:
    <Payload status="success" id="atom2" Role="C" DImsg=" Exception :
    Input values '["3" , "3"]' does not match with expected class names
    '["com.sap.smb.sbo.api.ICompany" , "java.lang.Integer"]' for SBO object type '156'"
    DIresult="failure" keyvalue="3" keyname="AbsEntry" payload="atom1" objectid="156"
    method="Synchronous Update" b1login="Technical User" system="0010000100"/>
    I just can’t figure out meaning of the error-message…anyone can help?
    Thanks in advance!
    Best Regards
    Alex

    Hey Alex,
    I have a similar problem. I suppose you have solved your problem, because this post is very old. Perhaps you could share the solution?
    Best regards
    Benjamin

  • Case when statement not working

    hi there, I am trying to work out how to get my case statement to work.
    I have got the following code. 
    select pthproto.pthdbo.cnarole.tpkcnarole, pthproto.pthdbo.cnaidta.formataddr as formataddr, cnaidta.dateeffect as maxdate, isnull(cast (pthproto.pthdbo.cnaaddr.prefix1key as varchar (50)),'') + ' ' + isnull(cast (pthproto.pthdbo.cnaaddr.prefix2key
    as varchar (50)),'')+ ' ' + isnull(cast (pthproto.pthdbo.cnaaddr.prefix3key as varchar (50)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.houseidkey as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component1
    as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component2 as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component3 as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component4
    as varchar (100)),'') + ' ' + isnull (cast (pthproto.pthdbo.cnaaddr.component5 as varchar (100)),'') as mailaddress, row_number() over(partition by pthproto.pthdbo.cnarole.tpkcnarole order by cnaidta.dateeffect desc) as rn into #address from pthproto.pthdbo.cnarole
    inner join pthproto.pthdbo.cnaidty on cnarole.tfkcnaidty =cnaidty.tpkcnaidty inner join pthproto.pthdbo.cnaidta on cnaidty.tpkcnaidty = cnaidta.tfkcnaidty inner join pthproto.pthdbo.cnaaddr on cnaidta.tfkcnaaddr = cnaaddr.tpkcnaaddr order by cnaidta.dateeffect
    select *, case when mailaddress is not null then mailaddress else formataddr end as test from #address where tpkcnarole = '18306695'
    The case when statement is struggling with how i have created the column mailaddress.  As it does seem to understand when it is null.  In the example I have got there is no value in any of the columns to create
    the mailaddress.  Hence why I am referencing it from elsewhere.  Due to having a way on the system where it picks up data from 2 different places.    The mailaddress is always correct if there is one, hence why
    trying to reference that one first.  So how do i change this case when statement to work ?            

    It's ok I have fixed my own problem
    when
    (mailaddress
    is
    null 
    or mailaddress

    then formataddr
    else mailaddress
    end
    as test
    case

  • Case when then not working

    In my database, two variable ID and time (varchar2) are there. I want to populate another variable using case when then by putting below conditon to convert like this
    But its not working. Can anyone help me
    if time =1 day then '1 Day'
    time > 2 days and time <=7 days then '2 to 7 days'
    time > 8 days and time <=15 days then '8 to 15 days'
    else 'not matching'
    ID Time
    12 1 days
    23 244 days
    12 2 days
    14 4 days
    15 6 days
    17 9 days
    select time,
    case WHEN
    UPPER(Time) = '1 DAY'
    THEN
    '1 day'
    WHEN
    UPPER(Time) Between '2 DAYS' and '7 DAYS'
    THEN
    '2 to 7 days'
    WHEN
    UPPER(Time) Between '8 DAYS' and '15 DAYS'
    THEN
    '8 to 15 days'
    ELSE
    'Not matching'
    END "update time"
    from table1

    900487 wrote:
    In my database, two variable ID and time (varchar2) are there. If you are storing Days in a column store it as NUMBER or INTERVAL data type. The way you have stored the value looks incorrect.
    What you can do is extract the number portion of your time column and apply the CASE statement. Something like this
    SQL> with t
      2  as
      3  (
      4  select 12 id, '1 days' time1 from dual union all
      5  select 23 id, '244 days' time1 from dual union all
      6  select 12 id, '2 days' time1 from dual union all
      7  select 14 id, '4 days' time1 from dual union all
      8  select 15 id, '6 days' time1 from dual union all
      9  select 17 id, '9 days' time1 from dual
    10  )
    11   select id,
    12          time1,
    13          case when time1 = 1              then '1 day'
    14               when time1 between 2 and 7  then '2 to 7 days'
    15               when time1 between 8 and 15 then '8 to 15 days'
    16               else 'not matching'
    17          end "update time"
    18     from (
    19              select id, to_number(regexp_substr(time1, '^[[:digit:]]*')) time1
    20                from t
    21          )
    22  /
            ID      TIME1 update time
            12          1 1 day
            23        244 not matching
            12          2 2 to 7 days
            14          4 2 to 7 days
            15          6 2 to 7 days
            17          9 8 to 15 days
    6 rows selected.

  • Where case when query not running at all in 11.2.0.3

    Hi,
    I have a query that was running fine till the time we were in 11.1.0.7. Last month, we had a migration to 11.2.0.3, and the query has stopped running since then. It runs indefinitely, and finally I have to kill it. However, until 11.1.0.7, I had absolutely no problems with it. Not sure what changed in 11.2.0.3 that causes it to never give me a result. The query is as below:
    SELECT T1.NAME,T2.AGE,T2.level, T2.AMT,
    FROM table1 T1, table2 T2
    WHERE (CASE WHEN
    (T1.name = 'Peter' AND SUBSTR(T1.desc,1,15)=SUBSTR(T2.description,1,15))
    THEN 1
    ELSE 0
    END)=1;
    Please advise!
    Thanks in advance.

    Hi,
    CrazyAnie wrote:
    Hi,
    I have a query that was running fine till the time we were in 11.1.0.7. Last month, we had a migration to 11.2.0.3, and the query has stopped running since then. It runs indefinitely, and finally I have to kill it. However, until 11.1.0.7, I had absolutely no problems with it. Not sure what changed in 11.2.0.3 that causes it to never give me a result. The query is as below:
    SELECT T1.NAME,T2.AGE,T2.level, T2.AMT,
    FROM table1 T1, table2 T2
    WHERE (CASE WHEN
    (T1.name = 'Peter' AND SUBSTR(T1.desc,1,15)=SUBSTR(T2.description,1,15))
    THEN 1
    ELSE 0
    END)=1;
    Please advise!I'm surprised it runs in any version. You have a comma right before the keyword FROM. If you were not getting a compile-time error, that was a bug in 11.1.0.7 that they fixed by 11.2.0.3.
    It's still strange that the query runs for a long time. I would expect it to give you an error when you tried to compile it. Is there any chance that what you posted is not what you're actually running?
    Also, LEVEL, NAME and DESC are not good column names. How Oracle reacts to using keywords like that as column names can vary from version to version. If a word is in v$reserved_words.keyword, then it's best to avoid using it as a column (or table, or variable, or schema) name.
    Edited by: Frank Kulash on Nov 21, 2012 1:33 PM
    By the way, that WHERE clause is a lot more complicated than it needs to be. Why not use
    WHERE      t1.name = 'Peter'
    AND      SUBSTR ( t1."DESC"     -- If you must use DESC, double-quote it
                , 1
                , 15
                ) = SUBSTR ( t2.description
                               , 1
                     , 15
                     )? Always think carefully before using CASE in a WHERE (or HAVING, or START WITH, or CONNECT BY) clause.

  • Multiple row column-sharing with GridBadLayout does not work as expected

    I was trying to figure out why I could not initially accomplish the following with a GridBagLayout:
    Row0: 0000011111
    Row1:      1111122222
    Row2:           2222233333The above is supposed to be 3 JLabels on three different rows:
    The 1st row has a single JLabel starting in column 0 with a width of 2, extending it to column 1.
    The 2nd row has a single JLabel starting in column 1 with a width of 2, extending it to column 2.
    The 3rd row has a single JLabel starting in column 2 with a width of 2, extending it to column 3.
    The entire grid is 4 columns and 3 rows total.
    Below I have two examples where I attempted the above. Only the 2nd example produces the desired effect. The 1st code example ends up putting both the Row 0 and Row 1 JLabel in the same column. This was surprising because I thought the GridBagLayout would give each column contained by a control enough weight to actually make those columns exist.
    Here is what my first code example below produces:
    Row0: 0000011111
    Row1: 1111122222
    Row2:           2222233333The first two JLabels, 0000011111 and 1111122222, appear in the same column, and the 3rd JLabel appears in the seemingly 2nd column. This was confusing to me which is the point of this whole post.
    In order to gain the desired effect, I had to place 4 blank dummy empty JLabel components in a non-visible Row 0 of the grid. I did this for all 4 columns of that invisible row 0. The row is non-visible because the JLabel have no text or output. After adding this non-visible Row 0, all of the original mentioned Rows 0 through 2 become Rows 1 through 2 respectively.
    For example:
    Row0: iiiiiIIIIIiiiiiIIIII
    Row1: 0000011111
    Row2:      1111122222
    Row3:           2222233333The above shows an inserted Row 0 with invisible labels that are not seen, but they seem to give weight to each column, allowing each to exist. Without doing this, as mentioned, the first code example (shown below) fails. The second example (also below) works, so it appears that putting the invisible controls into the first row, one in each column, somehow gives enough weight to each column to "establish" the column more so than otherwise.
    The big question I have is why didn't the first example work?
    I mean, in that example, I'm giving each JLabel equal weight, and each one takes up a width of 2 columns, so why doesn't the JLabel in the second row end up in column 1? Instead, both the original row 0 and row 1 JLabels appear in what looks like column 0, the same column. Does anyone know why this happened?
    The invisible control solution is fine but I'm just curious why it wasn't as intuitive as it should have been. The only thing I can come up with is that the weight of the 1st and 2nd JLabel (row 0 and 1) got combined in some fashion which combined them into column 1 which end up looking like column 0 since 0 somehow looses all weight. (???)
    ****************** THE FOLLOWING DOES NOT PRODUCE THE RIGHT EFFECTS ******************
    public class TestCoincidingColumns1 extends javax.swing.JFrame {
        /** Creates new form TestCoincidingColumns1 */
        public TestCoincidingColumns1() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            java.awt.GridBagConstraints gridBagConstraints;
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            getContentPane().setLayout(new java.awt.GridBagLayout());
            jLabel1.setText("LabelRow0Col0Wid2");
            jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 255, 255)));
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 0;
            gridBagConstraints.gridwidth = 2;
            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
            getContentPane().add(jLabel1, gridBagConstraints);
            jLabel2.setText("LabelRow1Col1Wid2");
            jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 1;
            gridBagConstraints.gridy = 1;
            gridBagConstraints.gridwidth = 2;
            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
            getContentPane().add(jLabel2, gridBagConstraints);
            jLabel3.setText("LabelRow2Col2Wid2");
            jLabel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 255, 0)));
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 2;
            gridBagConstraints.gridy = 2;
            gridBagConstraints.gridwidth = 2;
            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
            getContentPane().add(jLabel3, gridBagConstraints);
            pack();
        }// </editor-fold>
        * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TestCoincidingColumns1().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        // End of variables declaration
    ****************** THE FOLLOWING WORKS ******************
    public class TestCoincidingColumns1WithFix extends javax.swing.JFrame {
        /** Creates new form TestCoincidingColumns1WithFix */
        public TestCoincidingColumns1WithFix() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
            java.awt.GridBagConstraints gridBagConstraints;
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
            DummyRow0Col0 = new javax.swing.JLabel();
            DummyRow0Col1 = new javax.swing.JLabel();
            DummyRow0Col2 = new javax.swing.JLabel();
            DummyRow0Col3 = new javax.swing.JLabel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            getContentPane().setLayout(new java.awt.GridBagLayout());
            jLabel1.setText("LabelRow0Col0Wid2");
            jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 255, 255)));
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 1;
            gridBagConstraints.gridwidth = 2;
            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
            gridBagConstraints.weightx = 1.0;
            getContentPane().add(jLabel1, gridBagConstraints);
            jLabel2.setText("LabelRow1Col1Wid2");
            jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0)));
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 1;
            gridBagConstraints.gridy = 2;
            gridBagConstraints.gridwidth = 2;
            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
            gridBagConstraints.weightx = 1.0;
            getContentPane().add(jLabel2, gridBagConstraints);
            jLabel3.setText("LabelRow2Col2Wid2");
            jLabel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 255, 0)));
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 2;
            gridBagConstraints.gridy = 3;
            gridBagConstraints.gridwidth = 2;
            gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
            gridBagConstraints.weightx = 1.0;
            getContentPane().add(jLabel3, gridBagConstraints);
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 0;
            gridBagConstraints.gridy = 0;
            gridBagConstraints.weightx = 1.0;
            getContentPane().add(DummyRow0Col0, gridBagConstraints);
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 1;
            gridBagConstraints.gridy = 0;
            gridBagConstraints.weightx = 1.0;
            getContentPane().add(DummyRow0Col1, gridBagConstraints);
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 2;
            gridBagConstraints.gridy = 0;
            gridBagConstraints.weightx = 1.0;
            getContentPane().add(DummyRow0Col2, gridBagConstraints);
            gridBagConstraints = new java.awt.GridBagConstraints();
            gridBagConstraints.gridx = 3;
            gridBagConstraints.gridy = 0;
            gridBagConstraints.weightx = 1.0;
            getContentPane().add(DummyRow0Col3, gridBagConstraints);
            pack();
        }// </editor-fold>                        
        * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TestCoincidingColumns1WithFix().setVisible(true);
        // Variables declaration - do not modify                     
        private javax.swing.JLabel DummyRow0Col0;
        private javax.swing.JLabel DummyRow0Col1;
        private javax.swing.JLabel DummyRow0Col2;
        private javax.swing.JLabel DummyRow0Col3;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        // End of variables declaration                   
    }

    I think I figured out the general reason for the problem based on a quick trace through of the GridBadLayout code in a simple example, and I wanted to share my findings in case they may be useful to anyone else. I felt there were some concepts gleaned from the source code that don't appear reinforced with documentation or, more importantly, in tutorials or books I checked. That's why I wanted to share my findings with this simple yet perplexing example.
    This example is very much like the one in my original post except it is more simple and only uses two JLabels.
    I created a grid with the following settings:
    JLabel1,gridx=0,gridy=0,gridwidth=2,weightx=1.0
    JLabel2,gridx=1,gridy=1,gridwidth=2,weightx=1.0Using the character '1' for JLabel1, and the character '2' for JLabel2, and 'x' for an "empty" grid cell, the above gives me the following simple conceptual layout:
    11x
    x22But the 'x' cell columns don't receive any weight, so things actually appear as follows:
    11
    22Internally, GridBagLayout (GBL), is really producing the following:
    11x
    x22But since the 'x' locations take no weight, they therefore get no size, so both JLabels appear as though they are in the first and only column.
    From what I can see, it doesn't really matter what I do, I'll never be able to produce the following effect with just two JLabels:
    11x
    x22I cannot do the above with just two JLabel components and a GridBagLayout. The reason is that the GridBagLayout, while it does define a "grid" of rows and columns, the grid is not a grid that actually relates to what is displayed. It's really a grid that defines what I'll refer to as "weight collisions" or "weight pools." If two components share, say, a grid column, their weights will combine with respect to that column. But the total size of the grid doesn't play a role in enforcing that some sort of grid display is maintained. The grid can possibly do that, but it would probably be safer to view that result as a side-effect produced by using the "weight pools" created by the grid itself.
    In the above simple example, JLabel1 ends up giving gridx 1 (0 being first) its full weight of 1.0. The gridx 0 column receive zero weight from JLabel1. What happens is the code in GridBagLayout sees that there are no presently assigned weights to column 0 and it simply assigns all remaining unassigned weight of JLabel1 to JLabel1's last, right-most in this case, gridx column. This means that gridx 1 gets the full 1.0.
    By contrast, though, when processing JLabel2, the GridBagLayout sees the previously assigned 1.0 to gridx 1 (JLabel1's right-most grid column) and it ends up assigning all of JLabel2's weight to that same grid location, gridx 1. In this case, even though JLabel2 supposedly spans through to gridx 2, the actual gridx 2 column gets 0 weight from JLabel2 and therefore gets no width.
    The result is that both JLabel1 and JLabel2 give 100% of their weight to gridx column 1 (what I called above a "weight pool" rather than a grid location), and both gridx 0 and gridx 2 receive 0 weight and I'm guessing appear without any size. What's odd about this is that even though JLabel1 starts at gridx=0, it really doesn't draw itself anywhere but starting at gridx=1. Likewise, even though JLabel2 draws itself supposedly from gridx=1 through to gridx=2, it doesn't really go into gridx=2 because gridx=2 doesn't get any width.
    In fact, given the code in GridBagLayout, it doesn't matter how much weight I give to either JLabel, all 100% of the weight will end up in gridx 1, the "center" grid location. The only way to get columnar distribution is to create other components to force the GridBagLayout to see individual columns which match the "grid." When I do this, the columns allow me to create the JLabels in a fashion where they intent/stagger, where a JLabel can start at a "column" location that is in the middle of another JLabel.
    Given this, I've come to the conclusion that it's not worthwhile to look at the GBL "grid" as a grid that propagates grid-like visual locations. It's more like the grid exists during the computation of weights which end up determining the true columns and rows that will visually exist, which may well not be anything like the grid locations one might visualize when looking at the constraints used.
    I think it's unfortunate that many examples and tutorials don't reinforce this concept with simple examples that help one grasp this easily. Most examples I see actually can fool a user into thinking a grid is a true grid in that positions represent visual locations, or that a control spanning into a grid column means that weight will be (at least) partially distributed there.
    You very often won't see the problem I'm describing above when you have dialogbox-like alignment of components which most tutorials and examples utilize. For example, if I take the same example as above, but intent JLabel so that it's gridx is 2, not 1, then both JLabels will not be sharing a single grid column so their weights won't collide. In such a case, one might be misled into thinking that a GridBagLayout's grid is truly providing row/col locations when it's not really doing that. Instead, in this latter case, one is really gaining that effect because certain unintuitive weight collisions. which would produce unexpected results, are being avoided.
    I thought weightx values would give a weight equally to all gridx columns that a component spans but that doesn't seem to be the case here. In fact, it's not even a components first column in my simple example above. GBL causes JLabel1 to given all its weight to gridx=1 (and nothing to gridx=0) while GBL causes JLabel2 to give all its weight to gridx=1 (and nothing to gridx=2). In one case, JLabel1, all weight goes to its right-most spanned-to column, while with JLabel2, it goes to JLabel2's entire first gridx location.
    I guess this is what makes GridBagLayout (GBL) unintuitive. But I don't think it's so much unintuitive as it is probably not well documented. When you look at the source code, it explains stuff which should be in the docs. In fact, not one single book I saw gave any help in solving this problem. I'm guessing this is largely because folks use GBL through trial and error until they get what they want, and perhaps they don't often need to indent halfway as I'm trying to do with GBL in the above example. If a lot of components are aligned, the results are not as unexpected. I'd say, though, that even in those not-so-confusing cases, GBL can troublesome without knowing its grid is all about a grid of weight pools which may or may not produce a visual grid depending on all components' constraint settings.

Maybe you are looking for

  • Any Ideas on this? (K7N415 PRO)

    An NForce board that doesn't like a Gainward GF4 Ti4200? This freaking crap blew my mind for about 3 hrs trying to get the system to boot. The system loves my Leadtek GF3Ti500. And my AMD Dualie likes the GF4 LOL. The Nforce would hang at boot with M

  • Aspect Ratio Problem (black bars on top and bottom in the preview window)

    I have iMovie 08 and I have been shooting video on my new Canon HF100. It appears that in iMovie preview window my 1920x1080 (and even the ones I bring in in 960x540) videos appear to be in wrong aspect ratio - they are stretched beyond 16:9 ratio ho

  • WSDL Generating in ISO-8859-1 encoding want in UTF - 8

    Hi XI Geeks,        When I am using "Define Web Service" tool in Integration Directory, the WSDL file is being created with encoding <b>ISO-8859-1</b>, <i><b>but we want in "UTF-8"</b></i>.         Is there any setting we need to change in WAS which

  • Planning not working properly when user has Oracle Jinitiator installed

    Hi we have a lot of users that have Oracle Jinitiator installed to use with a system named Banner. These users have a few issues when using 11.1.1.3 - the enter key is not recognized on web forms and users cannot see business rules to execute them. H

  • Item category used for third party

    Gurus, need to know the item category used for third party process and its determination, kindly help. thanks SP