oracle-apexoracle-apex-19.1

Unable to assign value to page item from bar chart for inline popup


I've created a bar chart and dynamic action for inline pop up (classic report). When I click each bar popup box is coming up but its not giving the output from database.

Inline Popup with no data

steps used -

  1. Created region1 , chart and series (for bar chart).

  2. Created region2 , created classic report and made it as inline popup (for popup) Using the below query in Region2 select pws , prdct_cd from pws_data where pws = :PWS (If I send :PWS as 'PWS3' it will give 2 rows) refer below image

  3. Created a dynamic action for region1 1.Event created When : Click Selection type : region Region : Region1 2.Action Created Action : Open Region Selection Type : region Region : Region2 4.Created Page Item : PWS for Region1

How do assign value

I'm unable to the pass values (PWS1 or PWS2 ..) to my Page Item (PWS).

I'm noobie in Apex. Kindly Help


Solution

  • Here is how you can do this, based on the sample data set EMP/DEPT. The functionality of the page is that you have a bar chart with the employee count per department. When you click on a department, you get a report listing all the employees for that department. The report is of type "inline dialog".

    1. Create chart (bar chart) with following SELECT statement:
    SELECT
      d.dname,
      d.deptno,
      COUNT(e.empno)
      FROM
           dept d
        LEFT OUTER JOIN emp e ON d.deptno = e.deptno
     GROUP BY
      d.dname,
      d.deptno
    

    Label = DNAME, Value = COUNT(e.empno).

    1. Create a hidden page item P1_DEPTNO in the chart region.

    2. Create a report (region name "Emp Report") in position "inline dialogs" with region template "inline popup". Table name: EMP, Where clause: deptno = :P1_DEPTNO, Page Items to Submit: P1_DEPTNO

    3. Create a Dynamic Action on change of P1_DEPTNO with 2 true actions: (1) Refresh region "Emp Report" and (2) Open Region "Emp Report". You need to refresh first to submit the value of P1_DEPTNO to the session so you only get the rows you need.

    4. Add a link to your chart of type "Redirect to URL" with the following javascript code:

    javascript:apex.item( "P1_DEPTNO" ).setValue( '#DEPTNO#' );
    

    That should be all. This worked for me, I suggest you try it with EMP/DEPT first and then convert to your own page. Tested on 20.2 but should work on 19.1 as well.