Thursday, April 4, 2013

Adding a where clause to a View Object through dummy View Criteria

This can be done by creating a dummy view criteria in View object without any criteria items in it. Then in the code like prepareRowSetForQuery() method of View Object the following can be done to achieve that.

        ViewCriteria vc = this.getViewCriteria("getMyItems");
       
        CriteriaClauses c = new CriteriaClauses();
        c.setClauseForQuery("OrgId IS NOT NULL");
        vc.setClauses(c);

The above will add where clause to the View object. In case multiple view criterias are used this will retain them as well while appending the where clause generated by it.

No comments:

Post a Comment