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:
That's pretty logical. You're referencing 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 differ from the value on the actual webpage.
This is the exact reason why there is the additional property "Page Items to Submit" with actions which 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"
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);