5

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

Bishan
  • 15,211
  • 52
  • 164
  • 258
user1035654
  • 181
  • 3
  • 4
  • 10

2 Answers2

15

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"

Ashish Mishra
  • 704
  • 1
  • 6
  • 20
Tom
  • 6,988
  • 1
  • 26
  • 40
  • 1
    Where is this "Page Items to Submit"? – AndrewT May 04 '16 at 21:32
  • 1
    @AndrewT depends. What are you doing? Dynamic action, plsql? If so, be sure to show all properties of the properties panel, not only the common ones. You can toggle these with two button found at the top of the property panel. – Tom May 04 '16 at 21:56
  • I have asked the following question http://stackoverflow.com/questions/37037563/oracle-apex-set-values-before-moving-to-another-page-items-are-all-null all I am trying to do is set a page item value before branching to another page without the page item becoming null again. This question seemed similar but I can't follow your answer :( – AndrewT May 04 '16 at 22:31
  • I am trying to do the same. Did you find a solution? – yazz.com Aug 18 '16 at 11:17
  • @Zubair can you please detail a bit more on what you are trying "to do the same"? Details can matter! – Tom Aug 18 '16 at 11:20
  • I am trying to select an item from a select list and then take the value selected to populate another field, without submitting to the server – yazz.com Aug 18 '16 at 11:22
  • @Zubair Can you just post another question then? It's not "totally" the same as this question, and we shouldn't deal with a bunch of back-and-forths in these comments. I'll gladly help with the new question, just provide the necessary details! – Tom Aug 18 '16 at 11:25
  • Sure: http://stackoverflow.com/questions/39017066/how-do-i-get-the-value-of-a-select-item-from-a-page-without-submitting-in-apex-5 – yazz.com Aug 18 '16 at 11:29
2

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);
asdf
  • 41
  • 5