Please disable your adblock and script blockers to view this page

Search this blog

Thursday, 3 November 2016

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


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 requeries viewObject and filters committed records only

So for this type of requirement we can use view criteria. View criteria works on basis of it's 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 commited yet also get filtered


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


Dropped Departments viewObject as table and form on page, createInsert operation as button and a button to filter Departments viewObject using this 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 selected side


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 table for Locaion Id 555 , it is not committed and after click on Execute View Critera 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 record set

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


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

Cheers :) Happy Learning 

No comments :

Post a Comment