Upcom.eu Blog

November 25, 2008

Multiple View Criterias. One Result.

Filed under: ADF, Jdeveloper 11g — Tags: , , — Stassinopoulos Dimitris @ 5:19 pm

Here is a Hint of how to take advantage of ADF and ViewCriterias.

There are cases that users demand to have more than QueryCriterias for a specific page; There is also the case to have those QueryCriterias in different tabs and disclose the desired one and have a conjunction of both in the result form or table at the same time. This functionality could be desired in many cases and sometimes could not be avoidable.

Some cases when the criteria attributes are too many to fit in one page, or if the user will want to reset some of the attributes and not all, then, you need to use two or even more PanelQuery components to produce one joined query.

In ADF this means to create more than one ViewCriterias in the viewObject.

But, I faced the problem of applying all those view criterias as a one combined query. The result was not filtering from all view criterias but the one disclosed.

At first my mind went on partial triggers, messing with iterators etc, but the solution was much quicker and more elegant.

Follow the steps described below into your application and see the results

  1. Go to your ViewObject and create the Java Implementation class

  2. Inside the class Override the executeQuery() method.

  3. Place the following code:

@Override

public void executeQuery() {

//get all view criteria names

String[] allViewCriterias=this.getAllViewCriteriaNames();

// apply them as one joined Criteria

this.setApplyJoinedViewCriteriaNames(allViewCriterias);

//now execute query.

super.executeQuery();

}

That’s it!

Now you can have as many ViewCriterias as you want and have one joined Query.

The method is called every time you press search button no matter in which Panel Query you are on and you can reset some attributes and not all.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress