Oracle APEX: Dynamic Component Management using Server-Side Conditions

In Oracle APEX, effectively managing component visibility based on conditions can greatly enhance user experience. Below, we outline two scenarios:



Scenario 1: Hiding Reports/Regions

Identify Conditions: Determine the conditions that trigger the visibility change. For instance, consider NULL values of items P560_DD and P560_INSURANCE_ID.

Access Page Design: Open the APEX page containing the target report or region.

Edit Attributes: Locate the report/region and access its attributes.

Set Server-Side Condition: Choose "PL/SQL Function Body" as the condition type.

Write PL/SQL Code: Use the provided code:

begin
    if :P560_DD IS NULL AND :P560_INSURANCE_ID IS NULL THEN
        return FALSE;
    else
        return TRUE;
    end if;
end;

Save Changes: Save the modified attributes.

Test Visibility: Run the page to observe how the report/region's visibility changes based on the conditions. It will be hidden when both P560_DD and P560_INSURANCE_ID are NULL.


Scenario 2: Column Fill Reminder

 Implement Check: Create a PL/SQL process triggered on page submission.

 Write PL/SQL Code: Use the provided code:

begin
    if
        :P560_DD IS NOT NULL AND
        :P560_INSURANCE_ID IS NOT NULL AND
        :P560_START_DATE IS NOT NULL AND
        :P560_END_DATE IS NOT NULL
    then
        apex_error.add_error (
            p_message => 'Please fill in all columns',
            p_display_location => apex_error.c_inline_in_notification
        );
    end if;
end;

Trigger Message: If the specified columns are filled, this code will trigger an error message prompting users to fill in all columns.


0 $type={blogger}:

Kommentar veröffentlichen