Patrick Buczkowski
Patrick Buczkowski

Reputation: 11

Get ID from a Row in a Interactive Report

I have an Interactive Report. The Interactive Report is in a form. There are images and other columns, like the ID, in the Report. How can I get the ID of the selected Row and store it in a Page Item?

Upvotes: 0

Views: 4965

Answers (1)

Koen Lostrie
Koen Lostrie

Reputation: 18665

This is an example based on the "emp" table in the emp/dept dataset. Functionality: when user clicks on an employee name, the empno of that user is set in page item P44_ITEM.

IR source:

select EMPNO,
       ENAME,
       JOB,
       MGR,
       HIREDATE,
       SAL,
       COMM,
       DEPTNO
  from EMP

There is a page item P44_ITEM that should be set to the EMPNO when the column ename is clicked in the report.

In the report, set the attribute "Column Formatting > HTML Expression" for the column "ENAME" to value <div class="sel-ename" data-empno="#EMPNO#">#ENAME#</div>. Explanation: wrap a div around the text, and add a class "sel-ename" to the cell and a "data-" attribute containing the empno value for the current row.

Create a dynamic action:

  • Event: Click
  • Selection Type: jQuery Selector
  • jQuery Selector: .sel-ename

Create a true action for the dynamic action

  • Action: Set Value
  • Set Type: javascript Expression
this.triggeringElement.dataset['empno']
  • Affected element P44_ITEM

Save and run.

Upvotes: 3

Related Questions