Oracle Apex 5.0 Set Value To Item using JavaScript

Mahmoud Momani picture Mahmoud Momani · Sep 16, 2015 · Viewed 18.1k times · Source

I built an interactive report based on View That Contains the master & details data, and I used Column Break To let the Report makes sense, and I used The master ID as a link to report that I built using FO Designer, so I used a hidden Item to set the ID value in it, and to print the report based on this value.

So I used a dynamic action to set the value from the record (using $s('P50_NEW',this.triggeringElement.id)). but the value didn't stored in the Item (The Session State), and I stuck here.

Please Can anyone help me how to do it please, and how to make apex to set the session state at first then print the report.

Thanks.

Answer

learningloop picture learningloop · Sep 16, 2015

As per the API Reference, the $s('P50_NEW',this,triggeringElementId) doesn't set the value in session state. The scope of $s(...) setting is for the current page, not for the session.

In order to set the value in session, you can invoke apex.server.process API to set the value in session.

So, the updated Javascript for Dynamic Execution will be like the following:

$s('P50_NEW',this.triggeringElement.id);
apex.server.process ( "SAVE_HIDDEN_VALUE_IN_SESSION_STATE", {
  x01: "set_session_state",
  pageItems: "#P50_NEW"
  }, {dataType: 'text'} );