Contact : oafqueries@gmail.com (OAF/ADF Trainings and Customizations)

Wednesday, November 18

How to Create Dependent LOV's

You have a requirement that based on dept in lov you need to show only employees for that dept in employee lov


You proceed this way:

Suppose Dept LOV is:

select dictinct dept from dept;



Employee Lov is:



select distinct dept,employee from emp where dept = :1;



Now in department LOV: Dept(messageLOV Input)

create a lov map:

1) LOV region item: department

2) return item : Dept

3) critirea item: Dept



Now in employee LOV: Employee(messageLOV Input):



create two lov maps:
1)

LOV region item: emp

return item:Employee

critirea item: Employee

2)

LOV region item: dept

return item:null

critirea item: Dept

Programatic Query : True



Now for employee LOV region create a new controller and write this code in PR



Dictionary passiveCriteria = (Dictionary)pageContext.getLovCriteriaItems();

String lov = (String)passiveCriteria.get("dept");//grab the department from critirea

System.out.println("Critirea item value is "+lov);

OAApplicationModule am = pageContext.getApplicationModule(webBean);

Serializable para[] = {lov};

am.invokeMethod("executelov",para);



Now in AM set the where clause of employee lov in executelov() method.



public void executelov(String critirea)

{

getemployeelovVO1().setWhereClauseParams(null);

getemployeelovVO1().setWhereClauseParam(0,critirea);

getemployeelovVO1().executeQuery();

}



also in pagelayout controller's process request you need to first execute the employee lov without any data.



like



public void initemployeelov()

{

String test = "";

getemployeelovVO1().setWhereClauseParams(null);

getemployeelovVO1().setWhereClauseParam(0,test);

getemployeelovVO1().executeQuery();

}





Thanks,

Gaurav Sharma

7 comments:

  1. using very confusing terms dept Dept department
    need elaboration

    ReplyDelete
  2. hi Gaurav Sharma ,

    using this method i have created this dependent lov, is there any way to create dependent lov without writing codes in code.

    shashank srivastava

    ReplyDelete
  3. Hi Gaurav,

    My requirement of a dependent LOV is a bit different from what you've described here. I need to base my LOV criteria on a formValue on the page (which I'm initializing). I set the mappings as per your instructions, and added LOVCO that has code to initialize the where clause. My issue is that Dictionary passiveCriteria = (Dictionary)pageContext.getLovCriteriaItems(); returns null and thus my LOV does not query any records. Can you please help?

    TIA
    Alka

    ReplyDelete
  4. Why do you need to call initemployeelov initially? I don't get this.

    Yash

    ReplyDelete
  5. Thanks and Regards. Oracle Apps R12 Training Videos at affordable cost. please check oracleappstechnical.com

    ReplyDelete