Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apex 5 : Dynamic action set page item value

When using the new apex 5 release I'm encountering the following issue:

Can't get the value of page items through plsql:

nv(:P2_TO, :P2_FROM) <<< DOESN'T WORK *I Yes P@_FROM exist and verified
nv(:P2_TO, 'test') <<< DOES WORK

I have tried this both on apex.oracle.com and my own host both wont work.

Some more info:

enter image description here

enter image description here

enter image description here

like image 970
user1035654 Avatar asked Apr 20 '15 18:04

user1035654


2 Answers

That's pretty logical. You're referencing the session state of the variables, and it is likely empty. It's not because items P2_TO or P2_FROM have a value on the page in your browser that they have a value set in session state. For example, load your page, enter a value in P2_FROM. Then click "Session" on your developer toolbar and you'll see there is no value in P2_FROM.
The value in session state can differs from the value on the actual webpage.

This is the exact reason why there are the additional property "Page Items to Submit" with actions that have to communicate with the database (ie perform an ajax request to the webserver). This allows you to define items whose value has to be sent to the server so that in effect you can use their value.

So: for this type of action, add P2_TO to the list of "Page Items to Submit"

like image 177
Tom Avatar answered Sep 28 '22 00:09

Tom


You could always use apex util:

APEX_UTIL.set_session_state(p_name => 'PX_MY_ITEM', p_value => 'wibble');

Example 1

APEX_UTIL.set_session_state('P1_MY_ITEM','My Text Value');

Example 2

APEX_UTIL.set_session_state('P1_MY_OTHER_ITEM', 42);

Example 3

APEX_UTIL.set_session_state('P1_MY_OTHER_OTHER_ITEM', MY_PLSQL_VARIABLE);
like image 31
asdf Avatar answered Sep 27 '22 23:09

asdf