X

Shay Shmeltzer's Oracle Development Tools Tips

  • November 24, 2009

Passing Value Between Pages to Filter a View Object

Shay Shmeltzer
Director of Product Management - Oracle

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.

Join the discussion

Comments ( 15 )
  • Boris Thursday, December 3, 2009
    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
  • shay Thursday, December 3, 2009
    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
  • Myung Thursday, January 28, 2010
    Hi Shay... :)
    This post is great.. I have help from it.
    However, I'm wondering something...
    i tried passing two values..it did not work.
    how to declare property of set action listener?
    is it impossible? please, help me.
  • Kiran Tuesday, November 16, 2010
    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 "#{pageFlowScrope.pid} is unknown property" .
    Do we need to set any other property inorder to recognize this parameter value.
  • shay.shmeltzer Monday, November 22, 2010
    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.
  • Santosh Vaza Tuesday, December 21, 2010
    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.
  • shay.shmeltzer Wednesday, December 22, 2010
    Your scenario sounds like this one: http://blogs.oracle.com/shay/2009/12/adf_query_with_parameters_and.html
  • Betto McRose Thursday, March 17, 2011
    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 ?
  • shay.shmeltzer Thursday, March 17, 2011
    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.
  • guest Tuesday, July 12, 2011

    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?


  • Shay Tuesday, July 12, 2011

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

    Something like this:

    http://blogs.oracle.com/shay/entry/popup_details_for_a_table_reco


  • guest Thursday, July 14, 2011

    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.


  • shay Thursday, July 14, 2011

    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: http://blogs.oracle.com/shay/entry/combining_multiple_queries_and


  • guest Monday, July 18, 2011

    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


  • shay Tuesday, July 19, 2011

    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.


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.