0

I am using Oracle APEX 23.1.0, and I have an interactive grid/interactive report region. I want to make a button that groups the data by some predetermined columns COL1 and COL2, and count the number of rows in each group. The problem is that I want to do all this with a JavaScript dynamic action that is triggered when some button I placed is clicked.

I have not been able to find any information in the documentation on how to find the possible actions or how to execute them. Is this possible?

The Bosco
  • 196
  • 12

1 Answers1

1

For the sake of simplicity, lets take an interactive report. I have not tested this approach for a read only interactive grid.

These are the steps:

  • Create a pipelined function that uses the function APEX_REGION.OPEN_QUERY_CONTEXT to retrieve the last query executed for the interactive report.
  • Loop through the result set and store the group names / group count in a pl/sql table of records.
  • Then loop through the table of records and pipe the group name / count
  • in your dynamic action you'll be able to select from the pipelined function.

You have not mentioned what you want to do with the results so can't really tell you more. For an example on how to use a APEX_REGION.OPEN_QUERY_CONTEXT, check this blog.

Koen Lostrie
  • 14,938
  • 2
  • 13
  • 19
  • I just want to be able to let the final user do 2 of the many different actions with stand-alone buttons. Specifically, I just want to count the rows per group of some column. The second action I want to make is to show the bar chart of counts. I assume it should be doable with JavaScript instead of PL/SQL, since it can be done manually just clicking on the controls in the action button. – The Bosco Jul 10 '23 at 21:08
  • 1
    The option I'm describing is very feasable. That API was created to do what you describe. The blog I'm referring to does exactly that, it represents the data from the report query in another way - up to you to transform the data instead of using it line-by-line. I'm not sure what other answer you're expecting. If you think you can do it with javascript, feel free to do so. It will take longer (a lot longer !) to implement and be harder to maintain going forward. – Koen Lostrie Jul 10 '23 at 21:33
  • Thanks. Then, I'll definitely try this method instead. – The Bosco Jul 10 '23 at 22:00