# 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](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:

```sql
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:

```sql
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:

```xml
<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:

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