Sometimes you need dynamic ViewCriteria that you can handle at runtime ,
here is the solution ,you can create and apply ViewCriteria Programmatically-
Sample UseCase-
here is the solution ,you can create and apply ViewCriteria Programmatically-
Sample UseCase-
- Suppose you have Department VO
- You want to filter this VO for DepartmentId 10
- Do this using this code snippet
/**Get ViewObject*/
ViewObject vo = getAm().getDepartments1();
/**Create ViewCriteria on ViewObject*/
ViewCriteria vc = vo.createViewCriteria();
/**Create ViewCriteriaRow for that Criteria*/
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
/**Set the values for ViewCriteriaRow*/
vcRow.setAttribute("DepartmentId", 10);
/**Add row to ViewCriteria*/
vc.addRow(vcRow);
/**Apply Criteria on ViewObject*/
vo.applyViewCriteria(vc);
/**Execute ViewObject*/
vo.executeQuery();
ViewObject vo = getAm().getDepartments1();
/**Create ViewCriteria on ViewObject*/
ViewCriteria vc = vo.createViewCriteria();
/**Create ViewCriteriaRow for that Criteria*/
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
/**Set the values for ViewCriteriaRow*/
vcRow.setAttribute("DepartmentId", 10);
/**Add row to ViewCriteria*/
vc.addRow(vcRow);
/**Apply Criteria on ViewObject*/
vo.applyViewCriteria(vc);
/**Execute ViewObject*/
vo.executeQuery();
public pcAMImpl getAm() {
pcAMImpl am = (pcAMImpl)resolvElDC("pcAMDataControl");
return am;
}
pcAMImpl am = (pcAMImpl)resolvElDC("pcAMDataControl");
return am;
}
Hi,
ReplyDeleteNot Understand below method. Can you please explain or share some screenshot..
public pcAMImpl getAm() {
pcAMImpl am = (pcAMImpl)resolvElDC("pcAMDataControl");
return am;
}
Dinesh
DeleteThis is the way to get ApplicationModule in managed bean and pcAMImpl is the name of application module impl class
but don't use this way of calling method instead see How to invoke model layer methods from managed bean (Best Practice to write business logic in ADF)
Ashish