apex_plugin_util.is_component_used

apex_plugin_util.is_component_used

I asked to have APEX_PLUGIN_UTIL.IS_COMPONENT_USED officially documented. So, it happened, sort of:
https://docs.oracle.com/en/database/oracle/apex/22.2/aeapi/IS_COMPONENT_USED-Function.html#GUID-7BE7EA7C-DCBA-4940-8FC8-8F6EB849E3AE
The documentation is essentially this:

APEX_PLUGIN_UTIL.IS_COMPONENT_USED (
    p_build_option_id           IN NUMBER   DEFAULT NULL,
    p_authorization_scheme_id   IN VARCHAR2,
    p_condition_type            IN VARCHAR2,
    p_condition_expression1     IN VARCHAR2,
    p_condition_expression2     IN VARCHAR2,
    p_component                 IN VARCHAR2 DEFAULT NULL )
    RETURN BOOLEAN;

What does it do?

Essentially, this is the function that is used for APEX server side conditions. If you pass in the same kinds of things you pass in for a server side condition, you get a TRUE or FALSE response. You never get null. You get TRUE if it is true, and FALSE if it is not true.

You might want a wrapper function that returns a Y or N:

create or replace function is_component_used_yn (
                p_build_option_id           IN NUMBER   DEFAULT NULL,
                p_authorization_scheme_id   IN VARCHAR2,
                p_condition_type            IN VARCHAR2,
                p_condition_expression1     IN VARCHAR2,
                p_condition_expression2     IN VARCHAR2,
                p_component                 IN VARCHAR2 DEFAULT NULL )
            return varchar2 is
begin
  return case when 
    apex_plugin_util.is_component_used (
    p_build_option_id           => p_build_option_id,
    p_authorization_scheme_id   => p_authorization_scheme_id,
    p_condition_type            => p_condition_type,
    p_condition_expression1     => p_condition_expression1,
    p_condition_expression2     => p_condition_expression2,
    p_component                 =>  p_component)
    then 'Y'
    else 'N'
    end;
end is_component_used_yn;

As you can see, the documentation leaves a little to be desired. Most importantly, what are the allowable values for p_condition_type? Well, you asked (or I did) so here is the answer:

<select size="1" class="a-Property-field a-Property-field--select" id="peMain_22" data-property-id="5100">
<option value="" selected="true">- Select -</option>
<option value="EXISTS">Rows returned</option>
<option value="NOT_EXISTS">No Rows returned</option>
<option value="EXPRESSION">Expression</option>
<option value="FUNCTION_BODY">Function Body</option>
<option value="REQUEST_EQUALS_CONDITION">Request = Value</option>
<option value="REQUEST_NOT_EQUAL_CONDITION">Request != Value</option>
<option value="REQUEST_IN_CONDITION">Request is contained in Value</option>
<option value="REQUEST_NOT_IN_CONDITION">Request is NOT contained in Value</option>
<option value="VAL_OF_ITEM_IN_COND_EQ_COND2">Item = Value</option>
<option value="VAL_OF_ITEM_IN_COND_NOT_EQ_COND2">Item != Value</option>
<option value="ITEM_IS_NULL">Item is NULL</option>
<option value="ITEM_IS_NOT_NULL">Item is NOT NULL</option>
<option value="ITEM_IS_ZERO">Item is zero</option>
<option value="ITEM_IS_NOT_ZERO">Item is NOT zero</option>
<option value="ITEM_IS_NULL_OR_ZERO">Item is NULL or zero</option>
<option value="ITEM_NOT_NULL_OR_ZERO">Item is NOT NULL and NOT zero</option>
<option value="ITEM_CONTAINS_NO_SPACES">Item contains no spaces</option>
<option value="ITEM_IS_NUMERIC">Item is numeric</option>
<option value="ITEM_IS_NOT_NUMERIC">Item is NOT numeric</option>
<option value="ITEM_IS_ALPHANUMERIC">Item is alphanumeric</option>
<option value="VALUE_OF_ITEM_IN_CONDITION_IN_COLON_DELIMITED_LIST">Item is in colon delimited list</option>
<option value="VALUE_OF_ITEM_IN_CONDITION_NOT_IN_COLON_DELIMITED_LIST">Item is NOT in colon delimited list</option>
<option value="USER_PREF_IN_COND_EQ_COND2">User Preference = Value</option>
<option value="USER_PREF_IN_COND_NOT_EQ_COND2">User Preference != Value</option>
<option value="CURRENT_PAGE_EQUALS_CONDITION">Current Page = Page</option>
<option value="CURRENT_PAGE_NOT_EQUAL_CONDITION">Current Page != Page</option>
<option value="CURRENT_PAGE_IN_CONDITION">Current Page is in comma delimited list</option>
<option value="CURRENT_PAGE_NOT_IN_CONDITION">Current Page is NOT in comma delimited list</option>
<option value="PAGE_IS_IN_PRINTER_FRIENDLY_MODE">Current Page is in Printer Friendly Mode</option>
<option value="PAGE_IS_NOT_IN_PRINTER_FRIENDLY_MODE">Current page is NOT in Printer Friendly Mode</option>
<option value="IS_READ_ONLY">Page/Region is Read Only</option>
<option value="IS_NOT_READ_ONLY">Page/Region is NOT Read Only</option>
<option value="USER_IS_NOT_PUBLIC_USER">User is Authenticated (not public)</option>
<option value="USER_IS_PUBLIC_USER">User is the Public User (user has not authenticated)</option>
<option value="DISPLAYING_INLINE_VALIDATION_ERRORS">Inline Validation Errors displayed</option>
<option value="NOT_DISPLAYING_INLINE_VALIDATION_ERRORS">Inline Validation Errors NOT displayed</option>
<option value="CURRENT_LANG_EQ_COND1">Current Language = Value</option>
<option value="CURRENT_LANG_NOT_EQ_COND1">Current Language != Value</option>
<option value="CURRENT_LANG_IN_COND1">Current Language is contained in Value</option>
<option value="CURRENT_LANG_NOT_IN_COND1">Current Language is NOT contained in Value</option> value="NEVER">Never</option>
</select>

Yep, I just inspected a page from the builder and grabbed the HTML behind select list.

Just to put everything in one place, here is the associated help:

Type

Select a condition type that must be met in order for this component to be rendered or processed.

Available options include:

Rows returned
The SQL query returns one or more rows.
No Rows returned
The SQL Query returns no rows
Expression
The expression evaluates to TRUE.
Function Body
The function body returns TRUE.
Request = Value
The page request is equal to the text you enter into the Value attribute.
Request != Value
The page request is not equal to the text you enter into the Value attribute.
Request is contained in Value
The page request is contained in the text you enter into the Value attribute.
Request is NOT contained in Value
The page request is not contained in the text you enter into the Value attribute.
Item = Value
The value of the selected Item is equal to the text you enter into the Value attribute.
Item != Value
The value of the selected Item is not equal to the text you enter into the Value attribute.
Item is NULL
The value of the selected Item is empty.
Item is NOT NULL
The value of the selected Item is not empty.
Item is zero
The value of the selected Item is the number zero.
Item is NOT zero
The value of the selected Item is not the number zero.
Item is NULL or zero
The value of the selected Item is empty or the number zero.
Item is NOT NULL and NOT zero
The value of the selected Item is not empty and not the number zero.
Item contains no spaces
The value of the selected Item has no spaces.
Item is numeric
The value of the selected Item is numeric.
Item is NOT numeric
The value of the selected Item is not numeric.
Item is alphanumeric
The value of the selected Item is alphanumeric, containing only letters or numbers and no special characters.
Item is in colon delimited list
The value of the selected Item is completely contained in the text you enter into the Value attribute.
Item is NOT in colon delimited list
The value of the selected Item is not completely contained in the text you entered into the Value attribute.
User Preference = Value
The value of the Preference entered is equal to the text you enter into the Value attribute.
User Preference != Value
The value of the Preference entered is not equal to the text you enter into the Value attribute.
Current Page = Page
The current page is equal to the value you enter into Page.
Current Page != Page
The current page is not equal to the value you enter into Page.
Current Page is in comma delimited list
The current page is in the comma separated list you enter into Pages.
Current Page is NOT in comma delimited list
The current page is not in the comma separated list you enter into Pages.
Current Page is in Printer Friendly Mode
The current page has been toggled to