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
yea!! thanks!
ReplyDeleteusing very confusing terms dept Dept department
ReplyDeleteneed elaboration
hi Gaurav Sharma ,
ReplyDeleteusing this method i have created this dependent lov, is there any way to create dependent lov without writing codes in code.
shashank srivastava
Hi Gaurav,
ReplyDeleteMy 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
good one.
ReplyDeleteWhy do you need to call initemployeelov initially? I don't get this.
ReplyDeleteYash