Are You Keeping up with Your APEX Housekeeping?

Are You Keeping up with Your APEX Housekeeping?

·

4 min read

Oracle APEX has a daily DB job that performs internal housekeeping (deleting expired session state, rotating log tables, etc.). Just like APEX, developers should also perform regular housekeeping on their APEX applications to keep them clear of clutter. Every unused component, static file, etc. adds to the noise developers have to navigate; some unused components can even impact performance.

In this short, I will look at some areas where clutter can accumulate and provide tips to identify and remove it. I'll also cover other housekeeping tasks that APEX developers should know.

Server Side Condition Set to 'Never'

image.png This is probably the biggest cause of clutter in APEX applications. This can happen in many areas, including Regions, Page Processes, Report Columns, Buttons, and Page Items.

Use APEX data dictionary views to identify offenders. Once detected, delete them. Here are two queries to get you started.

-- Regions
SELECT workspace
,      application_id
,      page_id
,      page_name
,      region_name
FROM   apex_application_page_regions
WHERE condition_type_code = 'NEVER';
-- Page Items
SELECT workspace
,      application_id
,      item_name  
,      page_id
,      page_name
FROM   apex_application_page_items
WHERE  condition_type_code = 'NEVER';

Unused APEX Components

Unused APEX components are a significant source of clutter. You create a LOV for a page item, delete the page item and forget to delete the LOV. This causes a confusing proliferation of LOVs. New developers wonder, should I use the EMPLOYEE, the EMPLOYEE_ACTIVE, or the EMPLOYEE_NEW LOV?

The most frequently un-referenced components (in order of the confusion they cause) are:

  1. Pages Spotlight Search can help, but there is no easy way to detect unused pages. It is worth the effort to rid your application of them
  2. Application and Page Items Use Spotlight Search to check for references to unused items and delete them. Also, check your PL/SQL source for references to items using APEX_UTIL.SET_SESSION_STATE or GET_SESSION_STATE
  3. List of Values, Plugins, Build Options, Lists, Authorization Schemes Use the 'Utilization' reports in APEX Builder to check for unused components and delete them
  4. Static Application Files (Major cause of application export file size bloat). Use Spotlight Search to find references to these files and delete them
  5. Custom JS and CSS Libraries (We sometimes use JS and CSS libraries and then replace them with native APEX components. What we don't always do is remove references to load these libraries when we stop using them). 🧭 Application > Shared Components > User Interface Attributes > (JavaScript / Cascading Style Sheets) > File URLs and Page Property > (JavaScript / CSS File URLs) > Delete unused references
  6. In-Line Custom JS and CSS 🧭 Page Property > Function and Global Variable Declaration / Execute when Page Loads / Inline CSS > Delete unused code

Other Housekeeping Tasks

  • Session State Protection Check all pages and application items with Session State Protection Enabled. 🧭 Application > Shared Components > Security > Session State Protection
  • Authorization Schemes Check all pages (except public pages) have authorization schemes. 🧭 Application > Page List > Actions > Columns > (show column 'Authorization Scheme')
  • Embedded Code Check for embedded code that could be moved to PL/SQL packages or JS static files. 🧭 Application > Utilities > Embedded Code
  • Debug Logs Check your debug logs (APEX Debug, Logger, etc.) for error messages that your users may not be reporting

Post-Oracle APEX Upgrade Housekeeping Tasks

  • Run the application upgrade utility to check for components that need to be upgraded (e.g., Date Picker, Calendar). 🧭 Application > Utilities > Upgrade Application.
  • Check that your application Compatibility Mode version matches the installed application version. 🧭 Application > Shared Components > Application Definition > Properties > Compatibility Mode.
  • Unset 'Include Deprecated or Desupported Javascript Functions' and 'Include jQuery Migrate'. 🧭 Application > Shared Components > User Interface Attributes > JavaScript
  • Refresh the Universal Theme 🧭 Application > Shared Components > User Interface Attributes.
  • Drop the previous APEX version's product schema, e.g., DROP USER APEX_190100 CASCADE;

🔗 Read More