Select Page

I’m Ben Lee I’m into report development, data integration and data modelling. In this blog I explain how I helped a customer manage their own help text.

Recently I had the scenario where a customer wanted to be able to manage their own help text for a page in an application I was building for them. My requirements for a solution were quite simple; it needed to work with Apex’s built in help text functionality and templates. My goal is always to ensure whatever I build can survive an Apex environment upgrade. Basically, keep it simple and you will avoid problems in the future, plus you get the added bonus of getting any new generic functionality from every upgrade without rework. The information I found on this topic was surprising sparse and the options provided that helpful few.

Here’s the solution I came up with to solve my problem.

Create a table that users can maintain with the desired help text.

CREATE TABLE HELP_TEXT
(HELP_TEXT_ID NUMBER,
PAGE_ITEM_NAME VARCHAR2(50),
ITEM_NAME VARCHAR2(50),
PAGE_ITEM_HELP VARCHAR2(400),
CONSTRAINT HELP_TEXT_PK PRIMARY KEY (HELP_TEXT_ID),
CONSTRAINT HELP_TEXT_UK UNIQUE (PAGE_ITEM_NAME));

Create a sequence for the primary key

CREATE SEQUENCE HELP_TEXT_SEQ;

Now for the steps in Apex.

  1. Build a form in Apex to maintain the help. Use the wizards to make a maintenance screen, enough said on that
  2. Build your desired Apex Page.
  3. Copy the page from Step 2.
  4. Change all items on page from Step 3 to Text Fields.
  5. From Page built in Step 2 create a Page Process of type PL/SQL anonymous block, On Load – After Header. Then place the following code in the source.
    BEGIN
    FOR C1REC IN (SELECT * FROM HELP_TEXT)
    LOOP
    APEX_UTIL.SET_SESSION_STATE(C1REC.PAGE_ITEM_NAME, C1REC.PAGE_ITEM_HELP);
    END LOOP;
    END;
    

    apex_page_item_help_page_process

  6. On any items that require dynamic help text.
      1. Insert a row into the HELP_TEXT Table. For example, if your page has an item called P1_NOTE and you have copied that page to a new Page 2 such that you now have a P2_NOTE. In the HELP_TEXT table PAGE_ITEM_NAME should be set to P2_NOTE for that time. The help text can be set at any message.
        apex_page_item_help_text
      2. On P1_NOTE help text use the text substitution &P2_NOTE. for the source of the help textapex_page_item_help

That’s it, your page items will now have a standard template driven help link with dynamic content whenever the PAGE_ITEM_HELP value in the table is not null or empty.
apex_page_item_help_text_message

Thanks, Ben.

All the code, all the fun – Ben 

Ben writes blogs about the technical side of BI the code, all the code and not much other than the code. 

You can read Ben’s blog Oracle Apex 5 on AWS Linux or all of Ben’s blogs here.

We run regular business intelligence courses in both Wellington and Auckland. Find out more here.

%d bloggers like this: