03 June, 2015

ADF ::: Creating View Criteria Programmatically

We can add view criteria programmatically at run-time to ViewObject. So that we not only depend on Design View Criteria.

The following is an example used to create View Criteria in Application Module Impl

ViewObject empVO= this.findViewObject("EmpVO");
ViewCriteria vc = empVO.createViewCriteria();
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();

// ViewCriteriaRow attribute name is case-sensitive.
// ViewCriteriaRow attribute value requires operator and value.
// Note also single-quotes around string value.
ViewCriteriaItem enameItem= vcRow.ensureCriteriaItem("Ename");
enameItem.setOperator("=");
enameItem.getValues().get(0).setValue("Mahmoud Elsayed");
vc.add(vcRow);

empVO.applyViewCriteria(vc);

 

Thanks
Recommended Post Slide Out For Blogger