This discussion is archived
1 2 3 4 Previous Next 55 Replies Latest reply: Dec 18, 2012 1:52 AM by adf009 Go to original post RSS
  • 30. Re: cascading lov using bean not passing selected parameter value
    user404 Pro
    Currently Being Moderated
    Change your logic a bit.
    For example, change this one :
    for (Row r1 : dciter.getAllRowsInRange()){
                selectItems.add(new SelectItem(r1.getAttribute("Organisationtypecode"), //as value
                                               (String)r1.getAttribute("Orgsubtypename")));  //as display 
                 oType  = (String)r1.getAttribute("Orgsubtypename");
                 otypecode = (String)r1.getAttribute("Organisationtypecode");
                 subtype = (String)r1.getAttribute("Orgsubtypecode");
    To:
    for (Row r1 : dciter.getAllRowsInRange()){
                 OrgSubList.add(new OrgSubType()r1.getAttribute("Orgsubtypename"),r1.getAttribute("Organisationtypecode"),  r1.getAttribute("Orgsubtypecode")));
                 }
    That way you can leave the method for setting the values to your SOC as it is.
    All data will be in the list which contains object you can control (like OrgSubType).
  • 31. Re: cascading lov using bean not passing selected parameter value
    adf009 Explorer
    Currently Being Moderated
    ok which values will i pass hear
            OrgTypeList.add(new OrgTypeBean(otypecode ,Description ));
          //  OrgSubList.add(new OrgSubType(orgtype,OrgSubtype,subtypecode));
            OrgSubList.add(new OrgSubType(otypecode,oType,subtype ));
    the code must be like this
            for (Row r1 : dciter.getAllRowsInRange()){
                         OrgSubList.add(new OrgSubType());
                         r1.getAttribute("Orgsubtypename");
                         r1.getAttribute("Organisationtypecode");
                         r1.getAttribute("Orgsubtypecode");
                         }
    Edited by: adf0994 on 2012/11/13 2:03 PM
  • 32. Re: cascading lov using bean not passing selected parameter value
    user404 Pro
    Currently Being Moderated
     for (Row r1 : dciter.getAllRowsInRange()){
                         
    OrgSubType org =new OrgSubType();
                         org.setName(r1.getAttribute("Orgsubtypename"));
                         org.seOrganistatiotTypeCode(r1.getAttribute("Organisationtypecode"));
                         org.setSubTypeCode(r1.getAttribute("Orgsubtypecode"));
    OrgSubList.add(org);
                         }
    If you have setters in OrgSubType of course.
  • 33. Re: cascading lov using bean not passing selected parameter value
    adf009 Explorer
    Currently Being Moderated
    cannot invoke error is getorgsubtype(object) cannot invoke getorgsubtype() in OrgSubType
            for (Row r1 : dciter.getAllRowsInRange()){
                                
            OrgSubType org =new OrgSubType();
                                org.getOrgsubtypename(r1.getAttribute("Orgsubtypename"));
                                org.getsubOrgType(r1.getAttribute("Organisationtypecode"));
                                org.getorgsubtype(r1.getAttribute("Orgsubtypecode"));
            OrgSubList.add(org);
                                }
    Edited by: adf0994 on 2012/11/13 2:18 PM

    Edited by: adf0994 on 2012/11/13 2:26 PM
  • 34. Re: cascading lov using bean not passing selected parameter value
    user404 Pro
    Currently Being Moderated
    You need to use the setter, not the getter ...
    org.setOrgsubtypename(...)
    This is just basic java.

    Edited by: 962432 on 13-nov-2012 12:33
  • 35. Re: cascading lov using bean not passing selected parameter value
    adf009 Explorer
    Currently Being Moderated
    ok i add cast org.setOrgSubTypename((String)r.getAttribute("Orgsubtypename"));
    now am able to select value from first LOV,BUT THE SECOND lov is empty,when i make selection form first LOV,IT SEEMS LIKE IS NOT PASSING VALUES TO SEND lov
    public class TestBean {
        
        private List<OrgTypeBean> OrgTypeList;
        private List<OrgSubType> OrgSubList;
        private OrgTypeBean  selectOrgType = new OrgTypeBean ();
       // private OrgTypeBean  selectOrgType;
     
        
        public TestBean() {
            
            OrgTypeList = new ArrayList<OrgTypeBean>();
            OrgSubList = new ArrayList<OrgSubType>();
           
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            BindingContainer bindings2 = BindingContext.getCurrent().getCurrentBindingsEntry();
            //access the name of the iterator the table is bound to. 
            DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("LutOrgsubtypesView1Iterator");
            DCIteratorBinding dciter2 = (DCIteratorBinding) bindings2.get("LutOrganisationtypesView1Iterator");
           // List<SelectItem> selectItems = new ArrayList<SelectItem>();
            
              
            
            for (Row r : dciter.getAllRowsInRange()){                       
                    OrgSubType org = new OrgSubType();
                               // org.getOrgsubtypename(r.getAttribute("Orgsubtypename")); 
                                org.setOrgSubTypename((String)r.getAttribute("Orgsubtypename"));
                                org.setOrgType((String)r.getAttribute("Organisationtypecode"));
                                org.setOrgSubType((String)r.getAttribute("Orgsubtypecode"));
            OrgSubList.add(org);
                                }
            
            for (Row r1 : dciter2.getAllRowsInRange()){
                OrgTypeBean otype = new OrgTypeBean();
                                 otype.setDescription((String)r1.getAttribute("Description"));
                                 otype.setOrgType((String)r1.getAttribute("Organisationtypecode"));    
                
                OrgTypeList.add(otype);
            }
        }
        
        public List<SelectItem> getOrgType()
           { 
              List<SelectItem> OrgTypeSelectItems = new ArrayList<SelectItem>();
              for (OrgTypeBean orgtype: OrgTypeList) 
              { 
                //SelectItem constructor (value, label)
                SelectItem item = new SelectItem(orgtype, orgtype.getDescrtion());
                OrgTypeSelectItems.add(item); 
             } 
              return OrgTypeSelectItems; 
            }
        
        public List<SelectItem> getSubTypeSelectedItem()
           { 
              List<SelectItem> subtypeSelectItems = new ArrayList<SelectItem>();
              if(selectOrgType != null)
              {
                  for (OrgSubType subtype:OrgSubList) 
                  { 
                    if(subtype.getsubOrgType() ==  selectOrgType.getOrgType())
                       // if(subtype.getsubOrgType().equal(selectOrgType.getOrgType())) == 0
    
                    {  
                       //SelectItem constructor (value, label)
                       //SelectItem item = new SelectItem(emp, emp.getFirstname() +" "+ emp.getLastname());
                       //SelectItem item = new SelectItem(subtype,subtype.getsubOrgType() + " "+ subtype.getOrgsubtypename());
                       SelectItem item = new SelectItem(subtype,subtype.getOrgsubtypename());
                       subtypeSelectItems.add(item); 
                    }
                  } 
              }
              return subtypeSelectItems; 
            }
        
        public void orgtypeChangedListener(ValueChangeEvent valueChangeEvent) {
            //selectOrgType = (OrgTypeBean)valueChangeEvent.getNewValue();
            //String tes
       // OrgTypeBean   test = (OrgTypeBean)valueChangeEvent.getNewValue();
        String test = (String)valueChangeEvent.getNewValue();
          //  System.out.println(test.getOrgType() ); 
            selectOrgType.setOrgType(test);
            
            //selectOrgType.setOrgType(test.getOrgType());
         
          
            //System.out.println(valueChangeEvent.getOldValue());
           
              
        }
        
    }
    Edited by: adf0994 on 2012/11/13 3:19 PM
  • 36. Re: cascading lov using bean not passing selected parameter value
    user404 Pro
    Currently Being Moderated
    I see that you did some debugging in orgtypeChangedListener, thats very good.
    Does the listener get the correct selected value?
    If so, add this to the listener.
    System.out.println(OrgSubList.size);
    Then you will know if your OrgSubList is getting filled up right.
    If its > 0, then your list is probably filled up correctly.

    If that is ok, the problem is probably somewhere in your getSubTypeSelectedItem() method
  • 37. Re: cascading lov using bean not passing selected parameter value
    adf009 Explorer
    Currently Being Moderated
    hi i find out that the if statement is comparing diffirent values if(subtype.getOrgType1().equals(selectOrgType.getOrgType())) i think is the way am geting values in my constructor ,because when i print out am geting below values which is wrong,am suppose to get same value e.g when i select PRIVATE it must print PRIV FOR BOTH VALUES.MY PROBLEM IS AM NOT ABLE TO SELECT VALUE FROM MY SECOND LOV BASED ON THE FIRST LOV SELECTION.currently am making selection in first lov when i go to second lov,am geting one selection values ,iTHE SECOND lov does not change if i make diffirent selection from first LOV

    帖子经 adf0994编辑过
  • 38. Re: cascading lov using bean not passing selected parameter value
    user404 Pro
    Currently Being Moderated
    You brackets are wrong.
    Should be something like
    public List<SelectItem> getSubTypeSelectedItem()
           { 
              List<SelectItem> subtypeSelectItems = new ArrayList<SelectItem>();
              if(selectOrgType != null)
              {
                  for (OrgSubType subtype: OrgSubList)               
                  { 
                      System.out.println("OOtype " + subtype.getOrgType1());
                      System.out.println("01type" + selectOrgType.getOrgType());
     
                          if(subtype.getOrgType1().equals(selectOrgType.getOrgType()))    
                      {
                      System.out.println("Type " + subtype.getOrgType1());                  
                       SelectItem item = new SelectItem(subtype,subtype.getorgsubtype() + " "+ subtype.getOrgsubtypename() +" "+ subtype.getOrgType1());
                       subtypeSelectItems.add(item); 
                    }
                  } 
              }
              return subtypeSelectItems; 
            }
  • 39. Re: cascading lov using bean not passing selected parameter value
    adf009 Explorer
    Currently Being Moderated
    i change the code but now my second LOV IS empty
    Edited by: adf0994 on 2012/11/14 4:42 PM
    
    帖子经 adf0994编辑过                                                                                                                                                                                                                                            
  • 40. Re: cascading lov using bean not passing selected parameter value
    user404 Pro
    Currently Being Moderated
    Can you show us what it prints? (the system.out)
  • 41. Re: cascading lov using bean not passing selected parameter value
    adf009 Explorer
    Currently Being Moderated
    this is what is printing
    10

    帖子经 adf0994编辑过
  • 42. Re: cascading lov using bean not passing selected parameter value
    user404 Pro
    Currently Being Moderated
    It seems that your OrgSubList only contains PRIV
  • 43. Re: cascading lov using bean not passing selected parameter value
    adf009 Explorer
    Currently Being Moderated
    but there is PRIV AND GOV in the database this how i get data,IT ONLY DISPLAYING GOVT information IN SECOND LOV
        public TestBean() {
            
            OrgTypeList = new ArrayList<OrgTypeBean>();
            OrgSubList = new ArrayList<OrgSubType>();
           
            BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
            BindingContainer bindings2 = BindingContext.getCurrent().getCurrentBindingsEntry();
            //access the name of the iterator the table is bound to. 
            DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("LutOrgsubtypesView1Iterator");
            DCIteratorBinding dciter2 = (DCIteratorBinding) bindings2.get("LutOrganisationtypesView1Iterator");
           // List<SelectItem> selectItems = new ArrayList<SelectItem>();
           for (Row r1 : dciter2.getAllRowsInRange()){
              
                   OrgTypeBean otype = new OrgTypeBean();
                                otype.setOrgType((String)r1.getAttribute("Organisationtypecode")); 
                                otype.setDescription((String)r1.getAttribute("Description"));                                    
                            OrgTypeList.add(otype);
           
           }
                                    for (Row r : dciter.getAllRowsInRange()){                
                    OrgSubType org = new OrgSubType();
                                //otype.setOrgType((String)r1.getAttribute("Organisationtypecode")); 
                                org.setOrgSubType((String)r.getAttribute("Organisationtypecode"));
                                org.setOrgSubTypeName((String)r.getAttribute("Orgsubtypename"));                           
                                org.setOrgSubCode((String)r.getAttribute("Orgsubtypecode"));
            OrgSubList.add(org);
                                }
           
           
        }
    Edited by: adf0994 on 2012/11/15 3:55 PM
  • 44. Re: cascading lov using bean not passing selected parameter value
    user404 Pro
    Currently Being Moderated
    Just debug everything. This probably a mistake in a method, not any 'difficult' ADF problem.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points