45.47 PRINT_LOV_AS_JSON Procedure
This procedure outputs a JSON response based on the result of a two column LOV in the format:
[{"d:"display","r":"return"},{"d":....,"r":....},....]
Note:
The HTTP header is initialized with MIME type "application/json" as well.
Syntax
APEX_PLUGIN_UTIL.PRINT_LOV_AS_JSON (
p_sql_statement IN VARCHAR2,
p_component_name IN VARCHAR2,
p_escape IN BOOLEAN,
p_replace_substitutions IN BOOLEAN DEFAULT FALSE );
Parameters
Parameter | Description |
---|---|
p_sql_statement |
A SQL statement which returns two columns from the SELECT. |
p_component_name |
The name of the page item or report column that is used in case an error is displayed. |
p_escape |
If set to TRUE the value of the display column is escaped, otherwise it is output as is.
|
p_replace_substitutions |
If set to TRUE, apex_plugin_util.replace_substitutions is called for the value of the display column, otherwise, it is output as is.
|
Example
This example shows how to use the procedure in an Ajax callback function of an item type plug-in. The following call writes the LOV result as a JSON array to the HTTP output.
apex_plugin_util.print_lov_as_json (
p_sql_statement => p_item.lov_definition,
p_component_name => p_item.name,
p_escape => true );
Parent topic: APEX_PLUGIN_UTIL