Skip to Main Content

IR

LinkDeptnoEmpnoEnameJobMgrHiredateSalComm
Single Row View207566JONESMANAGER78391981-04-022975-
Single Row View207788SCOTTANALYST75661982-12-093000-
Single Row View207876ADAMSCLERK77881983-01-121100-
Single Row View207902FORDANALYST75661981-12-033000-
Single Row View307499ALLENSALESMAN76981981-02-201600300
  • 1 - 5 of 10

Info

Method to use the query of an Interactive Report, including all user defined filters, sort orders, etc., in a pl/sql procedure.
Change the settings of the IR and then click the Run Procedure button to see the results of the pl/sql procedure.

A similar (but more complex) method to get the query of a Classic Report can be found on the Get Classic Report query page.

Note 1: Make sure the columns you use in your code are always present in the query result. In this example, columns EMPNO and JOB are used in the code and therefore these columns are set "not hide-able" for the user.

Note 2: In recent Apex versions the apex_ir.get_report function has been deprecated - thanks to Yuri for pointing out that one!
The documentation states that you should use apex_region.open_query_context instead, but that is not really a 1-on-1 replacement... This post gives an example of a way of using that: https://srihariravva.blogspot.com/2021/10/interactive-grid-process-filtered-data.html

Note 3: I haven't found a way to get columns that are hidden from the user to still be included in the resulting query.
In the example I have tried a hidden column, 2 columns that are not shown because of server-side conditions, and a column that is not shown because of an authorization scheme.
None of these are included in the resulting query, excpet for the Hidden column - and that one is excluded in the final select statement, so that doesn't help.
This can be annoying but it also seems logical - if columns are not needed in the final result, there is simply no reason to include them. Unless you want to use them for something else of course, in which case you seem to be out of luck here.
Yuri tried to show hidden columns with the apex_region.open_query_context option mentioned above, but that seems to behave in the same way - hidden columns are not included.
The only thing I can think of next is to fill a collection first (including all the "hidden" columns), and then use that to both show the report AND access the hidden columns too. That's not elegant of course, but it could work.

Results

Code

Page

Identification
Page ID
Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Region Source

Report Column

Column Definition
Column Name
Display Type
Column Heading

Report Column

Column Definition
Column Name
Display Type
Column Heading
Server-Side Condition
Type

Report Column

Column Definition
Column Name
Display Type
Column Heading
Server-Side Condition
Type
Language
PL/SQL Expression

Report Column

Column Definition
Column Name
Display Type
Column Heading
Security
Authorization Scheme

Button

Name
Button Name
Text Label / Alt
Displayed
Sequence
Display in Region
Behavior
Action
Execute Validations

Process

Identification
Name
Type
Process Point
Sequence
Process Point
Run Process
Source
Process
Conditions
When Button Pressed