This discussion is archived
1 Reply Latest reply: Jan 8, 2013 4:52 PM by Shay Shmeltzer RSS

Display table of employees of a particular department PROGRAMATICALLY

adfSonal Newbie
Currently Being Moderated
I have created an AM with master/detail relationship of departments having employees. In the page, I have created LOV where the user will select a particular department. On selecting, a table will be displayed below of all the employees in that particular department.

In the backing bean, I have written the code below, which I suppose I have written correctly.
    public void displayNumber(ValueChangeEvent valueChangeEvent) {
        // Add event code here...
        BindingContext bctx = BindingContext.getCurrent();
        BindingContainer bindings = bctx.getCurrentBindingsEntry();

        
        JUCtrlListBinding list = 
                     (JUCtrlListBinding) bindings.get("DepartmentId");  
        Number selectedValue = (Number) list.getAttributeValue();

        _logger.info("selectedValue: " + selectedValue);

        OperationBinding method = (OperationBinding)bindings.get("displayNumberEmployees");
        method.getParamsMap().put("deptId", selectedValue);

        Object retVal = method.execute();
}
Now in the AM, I am struck with the coding part.
    public void displayNumberEmployees(Number deptId) {
        _logger.info("deptId: " + deptId);
        ViewObjectImpl vo = getDepartmentsView1();
        vo.setWhereClause("DEPARTMENT_ID = :P_DEPT_ID");
        vo.defineNamedWhereClauseParam("P_DEPT_ID", null, null);
        vo.setNamedWhereClauseParam("P_DEPT_ID", deptId);
        vo.executeQuery();
        ............
        ............
        ............


}
I need your help in achieving this task. One more thing: is it better to set the where clause and bind parameter condition in the VO itself (performance wise)?

JDev version: 11.1.2

Legend

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