Forum Stats

  • 3,838,655 Users
  • 2,262,389 Discussions
  • 7,900,724 Comments

Discussions

How to reference an interactive report row column & value

RayWon
RayWon Member Posts: 31
edited Aug 8, 2018 6:13AM in APEX Discussions

I want to have 2 interactive reports on the same page, one after the other.

I am having trouble getting the 2nd report SQL statement to use the value of one of the columns of the currently highlighted row.

Taking DEPT & EMP tables data as example:

The first report SQL statement:

select deptno, dname from dept;

The 2nd report SQL statement:

select ename, job, mgr, sal from emp where deptno=[first report deptno];

How do I reference the 1st report, its row & column & the value there in?

Answers

  • Scott Wesley
    Scott Wesley Member Posts: 6,231 Gold Crown
    edited Aug 8, 2018 1:03AM

    A number of ways, here is one

    1. Create hidden item: P1_DEPTNO
    2. In your Dept region, make Deptno a Link column
      1. Set the link target as url: javascript:$s('P1_DEPTNO, #DEPTNO#);
      2. Set the link text as: #DEPTNO#
    3. Create on change dynamic action on P1_DEPTNO
      1. Add action to refresh Emp report
    4. In your Emp region, set Page Items To Submit: P1_DEPTNO

    You may also be interested in

    Grassroots Oracle: Tutorial: Include action button in report

    zvi weinstock
  • Pavel_p
    Pavel_p Member Posts: 2,314 Gold Trophy
    edited Aug 8, 2018 6:13AM

    Hi,

    I would consider rendering a radiogroup on your master report as it's obvious which row is currently selected and you can easily select some value on page-load if needed. So the setup would be:

    master report based on the following select

    select apex_item.radiogroup(p_idx => 1,                            p_value => deptno,                            p_selected_value =>:p1_selected_dept,                            p_onchange => '$s(''P1_SELECTED_DEPT'',this.value)') as select_dept,      dname as dname,      loc as locfrom dept

    page item P1_SELECTED_DEPT (hidden with Value Protected = No) and a detail report based on

    select * from emp where deptno = :p1_selected_dept

    Page Item(s) to submit: P1_SELECTED_DEPT

    and a Refresh DA fired on P1_SELECTED_DEPT change event.

    Here https://apex.oracle.com/pls/apex/f?p=55379:1:3789963144266::::: is a working example and if you wanted to examine it, login to my workspace

    ws: pp_test

    user: test

    pwd: test

    Application 55379 - DA_on_IR

    Regards,

    Pavel

This discussion has been closed.