In my previous post I showed how a dynamic action can be executed by using $event.trigger(<name>).  Using the same call we can execute a dynamic action from a column link in a report.  Not only can the dynamic action be executed but a value can also be passed to the dynamic action.

This example has a report of employees in the emp table and when the name of the employee is clicked a dynamic action is run to load the employee data from the database and into some page items.

The column link is created with the Target set to a URL of "javascript:$.event.trigger('DAEvent','#EMPNO#');".  The Dynamic Action will be created to execute when the "DAEvent" event is triggered.  The EMPNO value from the corresponding row will be passed and used by the Dynamic Action.

The Dynamic Action is created with the When Event set to "Custom" and with "DAEvent" entered for the Custom Event.  The Selection Type option is set to "DOM Object" and "document" entered into the DOM Object field.

The EMP value that we passed with the event trigger can be referenced in a true action JavaScript Expression using "this.data"

In this true action the P82_EMPNO page item value is being set to the EMPNO value that is in the this.data JavaScript expression.

Then in a subsequent true action we can reference the value in the P82_EMPNO to retrieve and set some data from the database.

 

(Oracle Application Express) (Oracle APEX version 4.2)