Passing Value Between Pages to Filter a View Object

A frequent question we get from beginners is how to I choose a value on one page and pass it to another page to show a specific record or set of records.
In previous blog posts I showed how easy it is to do this when you are using the same view object on both pages - using the setCurrentRowWithKey operation, and In another entry I showed how to use an execute with params before a page loads to filter the data in that page.

But on OTN someone asked how do you do this when you use two different views on the two pages. This would be a combination of both techniques - but using a parameter passing instead of setCurrentRow operation.
So here is a little video showing the basic technique.
We are going to use a pageFlowScope variable to pass the value from one page to the filtering method (executeWithParam) and then to the second page.


Hi Shay! This post was very useful of me. But I have a little bit more complex requirements. VO deptByParam should have WHERE clause something like "WHERE :p_id IS NOT NULL AND department_id = :p_id". So it means that if p_id is null then show me all data. Next thing I need to do is passing url parameter for this p_id parameter. Thx Regards, Boris

Posted by Boris on December 02, 2009 at 05:08 PM PST #

Boris, Try to change your where clause to Where nvl(:p_id,department_id)=department_id You can pick URL parameters by accessing the request object in your expression language. Shay

Posted by shay on December 03, 2009 at 04:06 AM PST #

Hi Shay... :) This post is great.. I have help from it. However, I'm wondering something... i tried passing two did not work. how to declare property of set action listener? is it impossible? please, help me.

Posted by Myung on January 27, 2010 at 04:44 PM PST #

Nice to see such good post. I followed exactly steps mentioned. But, after adding the "SetPropertyListener" I am able to see exception at "To" value saying "#{} is unknown property" . Do we need to set any other property inorder to recognize this parameter value.

Posted by Kiran on November 16, 2010 at 06:25 AM PST #

Kiran, Do you get this error at design time or runtime? If this is at runtime - check your spelling? As you can see in the video the thing works fine.

Posted by shay.shmeltzer on November 22, 2010 at 04:39 AM PST #

Hi, I need some help in creating this form.. i have a textfield (say it accepts client id) with a submit button and a table that displays the data from data base table based on the client id entered. but the problem is that how should i query the data... ? following is my query Select rownum Srno,ACTION,ACTION_DATE,APPLN_TYPE,Client_ip,nvl(browserinfo,'NA') browserinfo from WEBTRXNLOG where USER_ID='<---text entered in client id textbox->order By ACTION_DATE desc Also this table has approx 100000 or more than that data. can you provide me some links to tutorials that would help me to complete this... Any suggestios appreciated. -Thanks.

Posted by Santosh Vaza on December 21, 2010 at 11:38 AM PST #

Your scenario sounds like this one:

Posted by shay.shmeltzer on December 22, 2010 at 05:43 AM PST #

very usefull man but I have this scenario: I have the result datatable search in the same page using the flow page is not working 'cause I'm assuming the hole page is refreshing so, which is the best solution for this ?

Posted by Betto McRose on March 17, 2011 at 01:06 AM PDT #

In a scenario with both parts on the same page you can probably just set the values into a viewScope object instead of a pageFlowScope. Then have the Form part based on that object. You can use partial page rendering to update just the Form part when the selection link is pressed.

Posted by shay.shmeltzer on March 17, 2011 at 01:22 AM PDT #

Hello Shay,
I want to load a popup which allows me to edit a specific record in the database table. The primary key of that view object has been stores as a page flow scope variable. Please suggest me how should I proceed?

Posted by guest on July 12, 2011 at 12:05 AM PDT #

guest, You can have the link that calls the popup activate the setCurrentRowWithKey operation of your VO.
Something like this:

Posted by Shay on July 12, 2011 at 04:33 AM PDT #

Thank you shay for your reply, but the link you advised me to refer couldn't solve the purpose. In the current use case, I have to load an EDIT INFO popup when the user clicks a command button. I have created a view object with the rows restricted by the "where USERNAME = : currentUser" clause and the username is stored as a page flow scope variable at the time of login. Unfortunately, I am unable to relate the bind variable and the page flow scope varible so that the edit form displays info regarding the current user only.

Posted by guest on July 13, 2011 at 08:26 PM PDT #

Guest, in that case your button will need to be calling the executeWithParams operation and passing the parameter to it before you open the popup.
Basic sample of using the executeWithParams is here:

Posted by shay on July 14, 2011 at 02:52 AM PDT #

Hi It was helpful for my scenario but i get

oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM DEPARTMENTS where DEPARTMENT_ID = :p_id

Caused By: java.sql.SQLException: Missing IN or OUT parameter at index:: 1
Please help me in resolving this issue

Posted by guest on July 18, 2011 at 01:59 PM PDT #

guest - looks like your parameter didn't get the value you expected and was null. Try running with the debugger and seeing if the value is in the right place. Use the OTN JDeveloper discussion forum for future questions of this kind.

Posted by shay on July 19, 2011 at 03:52 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:

« October 2016