Use View Criteria Query Execution Mode for In-Memory filtering of rows

Sharing is Caring

Hello All, Sometimes we need to filter uncommitted records and query based bind variable or setWhereClause method doesn’t do the job in that case as it re-queries viewObject and filters committed records only. So for this type of requirement, we can use view criteria. View criteria work on the basis of its query execution mode

By default, it is set to Database only and we can change it to Memory (In-Memory filtering only) and both (DB and In-Memory filtering)
Here In-Memory filtering means rows that are not committed yet also get filtered


Here we’ll see how view criteria query execution mode works, I have created viewCriteria on Departments view object

Dropped Departments viewObject as table and form on page, createInsert operation as a button and a button to filter Departments viewObject using these view criteria (viewCriteria is applied on viewObject at AM level)

 

To Apply ViewCriteria at AM level: Open Application Module — Select ViewObject — Click on Edit button — Shuttle view criteria to the selected side

View Criteria

Execute View Criteria button filters Departments view object

    /**
     * Method to filter Departments ViewObject for Location Id 1800
     */
    public void filterDepartments() {
        ViewObject deptVo = this.getDepartments1();
        deptVo.setNamedWhereClauseParam("BindLocId", 1800);
        deptVo.executeQuery();
    }

Now I added a new row in the table for Location Id 555, it is not committed and after click on Execute View Criteria button, we can see that it is appearing with filtered DB rows.
As Query Execution mode is Database so it doesn’t filter uncommitted rows that’s why location id 555 is appearing in the recordset

Now to filter In-Memory rows too, I have changed query execution mode to both and see the output

So this is how we can use ViewCriteria for In-Memory filtering of rows
Sample ADF Application- Download

Cheers 🙂 Happy Learning 

Related Posts

Leave a Reply

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