Search code examples
oracle-apex

Pass values between pages Oracle APEX


There is a problem transferring values between pages in the application. I have 2 pages on the first page there is a variable P9_ITEMID (when you run page 9, in this variable SQL Statement query writes the data). There is a second page 181. I want to move data from variable P9_ITEMID to variable P181_ITEM. To do this, I use the 'redirect to page in this application' option. But it doesn't work. Although I see in the variable P9_ITEMID there is data. But when you go to page 181 but P181_ITEM is empty. I would be grateful for help)) enter image description here

  • P9_ITEMID is a virtual variable that is not assigned to any column in the table. This mmin simply displays data. When I start the page, I see the data that was written to it due to the dynamic action

also i tried to write the value in P9 ITEMID this way My code:

 declare
v_empname items.id%type;
begin

  select id into v_empname 
    from items where id = :P9_ITEMID;
    
    apex_util.set_session_state('P9_ITEM_ID', v_empname);
    exception
    when others then
      apex_util.set_session_state('P9_ITEM_ID', null);
end;


Solution

  • I'm assuming that you have created a button with action: 'redirect to page in this application' and you want the session value of a page item to be passed to the target page.

    When an url is constructed using link builder, the link is built at page rendering time. It does not pick up any changes in session. Even when you set the session state in a dynamic action, it will not pick it up because the url is already rendered.

    To pick up any changes on that page, it is necessary that the page item value is set in session state and this is done by the "page processing".So if you use "Submit Page" on the button and create a branch to redirect to the page it will behave the way you want.