Creating and Executing View Criteria Programmatically

Sharing is Caring

Sometimes you need dynamic ViewCriteria that you can handle at runtime, ADF provides Java classes for handling View Objects, View Criteria and other business components.
Here is the solution for creating and executing View Criteria Programmatically.

Sample UseCase-

    • Suppose you have Department VO
    • You want to filter this VO for DepartmentId 10
    • You can 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*/
/**Apply Criteria on ViewObject*/
/**Execute ViewObject*/
public pcAMImpl getAm() {
pcAMImpl am = (pcAMImpl)resolvElDC(“pcAMDataControl”);
return am;

Cheers 🙂 Happy Learning

Related Posts

0 thoughts on “Creating and Executing View Criteria Programmatically”

  1. Hi,

    Not Understand below method. Can you please explain or share some screenshot..

    public pcAMImpl getAm() {
    pcAMImpl am = (pcAMImpl)resolvElDC("pcAMDataControl");
    return am;

Leave a Reply

Your email address will not be published. Required fields are marked *