32.3 OPEN_QUERY_CONTEXT Function

This function returns an APEX_EXEC query context returning current region data. Only native regions are supported at this time.

Syntax

FUNCTION OPEN_QUERY_CONTEXT (
  p_page_id                IN NUMBER,
  p_region_id              IN NUMBER,
  p_component_id           IN NUMBER    DEFAULT NULL,
  p_view_mode              IN VARCHAR2  DEFAULT NULL,
  --
  p_additional_filters     IN APEX_EXEC.T_FILTERS DEFAULT APEX_EXEC.C_EMPTY_FILTERS,
  --    
  p_first_row              IN NUMBER  DEFAULT NULL,
  p_max_rows               IN NUMBER  DEFAULT NULL,
  p_total_row_count        IN BOOLEAN,  DEFAULT FALSE,
  p_total_row_count_limit  IN NUMBER  DEFAULT NULL,
  return apex_exec.t_context;

Parameters

Table 32-2 OPEN_QUERY_CONTEXT Parameters

Parameter Description

p_page_id

ID of the page where the region is on.

p_region_id

ID of a specific region to open the query context for.

p_component_id

Region component ID to use. For interactive reports and interactive grids this is the saved report ID within the current application page. For JET charts, use the chart series ID.

p_view_mode

The view type available for the report. The values can be APEX_IR.C_VIEW_REPORT, APEX_IR.C_VIEW_GROUPBY, or APEX_IR.C_VIEW_PIVOT.

If p_view is null, it gets the view currently used by the report. If the p_view passed does not exist for the current report, an error is raised.

p_additional_filters

Additional filters to apply to the context.

p_first_row

Row index to start fetching at. Defaults to 1.

p_max_rows

Maximum amount of rows to get. Default unlimited.

p_total_row_count

Determines whether to retrieve the total row count. Defaults to false.

p_total_row_count_limit

Upper limit of rows to process the query on. This applies to interactive report aggregations or ordering. Default is no limit.

Example

The following example demonstrates how to get the query context for a given saved interactive report on page 1 and print the data out as JSON.

 declare
       l_context apex_exec.t_context;
   begin
       l_context := apex_region.open_query_context (
                        p_page_id => 1,
                        p_region_id => 2505704029884282,
                        p_component_id => 880629800374638220 );

       apex_json.open_object;
       apex_json.write_context( 'data', l_context );
       apex_json.close_object;
   end;