1 Reply Latest reply: Jan 8, 2013 6:52 PM by Shay Shmeltzer-Oracle RSS

    Display table of employees of a particular department PROGRAMATICALLY

    myinception
      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