This discussion is archived
4 Replies Latest reply: Nov 15, 2012 6:10 PM by bigchill RSS

Advanced LOV without links and associations

bigchill Newbie
Currently Being Moderated
Hi All

I read this article from Frank on "Advanced List interaction" in one of the many oracle sites and I found it very useful, but I have a few limitations and cant use the same. Reason being we dont have associations and view links in our project and we have to make do without them - (well unless there is NO OTHER option). Even our database doesnthave pk-fk fields.
The usecase I have is :
To add a new deduction record, the user should be able to select 1 of many jobs available from a combobox lov. Based on this job selected I have another dropdown lov called CustomStartDate field which is a transient field and mapped to the PeriodStartDate column in the VO table, that lists dates from the date this job became active.
The tricky bit is the PeriodStartDate LOv is populated using a union of broadly 2 select statements(actually more), so either the 1st or 2nd group of select statements gets querird based on a job bind variable. So the job bind variable determines which of the 2 select queries is executed and since its a union all, I get the necessary rows.
The problem I have is from the model layer I'm able to change the jobid using a valuechangelisterenr on the job lov and then re-execute the PeriodStartDate query by passing that job and I'm able to see the debug getting printed out that either of the 2 select statments executing.
Having said that I'm unable to populate the periodstartdate lov.

I'm using jdev 11.1.1.3.
Also, I'm open to a non-declarative option is there is one
  • 1. Re: Advanced LOV without links and associations
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    actually it seems that it is easier to use a dynamic list than a model driven list. However, see if the following code can be changed by you to meet your requirements
    BindingContext bctx = BindingContext.getCurrent(); 
    BindingContainer bindings = bctx.getCurrentBindingsEntry(); 
    JUCtrlListBinding lov = (JUCtrlListBinding)bindings.get("DepartmentId"); 
    ViewCriteriaManager vcm = lov.getListIterBinding().getViewObject().getViewCriteriaManager(); 
    
    //*************** this is where you customize this solution as you obviously only need to 
      *************** set a bind variable and execute the query *********************/
    
    //SAMPLE uses dynamic view criteria make sure the view criteria is cleared 
    
    vcm.removeViewCriteria(vcm.DFLT_VIEW_CRITERIA_NAME); 
    //create a new view criteria 
    
    ViewCriteria vc = new ViewCriteria(lov.getListIterBinding().getViewObject()); 
    
    //use the default view criteria name 
    //"__DefaultViewCriteria__" vc.setName(vcm.DFLT_VIEW_CRITERIA_NAME); 
    //create a view criteria row for all queryable attributes 
    
    ViewCriteriaRow vcr = new ViewCriteriaRow(vc); 
    //for this sample I set the query filter to DepartmentId 60. 
    //You may determine it at runtime by reading it from a managed bean
    //or binding layer 
    
    vcr.setAttribute("DepartmentId", 60); 
    //also note that the view criteria row consists of all attributes 
    //that belong to the LOV list view object, which means that you can 
    //filter on multiple attributes 
    vc.addRow(vcr); 
    lov.getListIterBinding().getViewObject().applyViewCriteria(vc); 
    Reason being we dont have associations and view links in our project and we have to make do without them - (well unless there is NO OTHER option). Even our database doesnthave pk-fk fields.

    Adding view links or associations add no harm to an ADF BC model project and instead simplify stuff greatly. I guess you have a reason for not using PK/FK constraints in the database - its no good design though.

    Frank
  • 2. Re: Advanced LOV without links and associations
    bigchill Newbie
    Currently Being Moderated
    Thanks Frank! I havent tried yur suggestion yet, but thought I'd clarify something here. I did not mention this.
    the 2 lovs are 2 separate LOV viewobjects. So Job is a JobCodeLOV with instance JobCodeLOV1, and CustomStartDate is a PayStartLOV with instance PayStartLOV1. Both these are member instances in application module which also has the COREVo viewobject which is the jsff page that populates all db columns as a form, of which the above 2 lovs are part of and mapped by transient attributes.
    Let me know if the code above is suits this caveat.

    Regarding, the db design; this is a migration project from the forms world , so yea I agree.
  • 3. Re: Advanced LOV without links and associations
    bigchill Newbie
    Currently Being Moderated
    The LOV doesnt get refresed with the new contents. problem still exisits. btw: I'm using model-driven lovs and its a dropdown of dates.
  • 4. Re: Advanced LOV without links and associations
    bigchill Newbie
    Currently Being Moderated
    please help!!!!

Legend

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