LG-C
LG-C

Reputation: 47

Oracle APEX 21 Application Item value that is displayed is old

Page 1 of my app is an interactive grid that displays a "Create Holds" button. Records can be selected and saved on Page 1. Then, when the "Create Holds" button is clicked, page 11 (a modal window) is displayed, prompting for the hold parameters. When the "Create" button is clicked on this modal window, a Dynamic Action executes 3 steps/actions:

  1. Executes Server Side Code to call a PL/SQL procedure which creates the holds and returns the output_msg parameter which contains the number of records created or updated. That output_msg parameter is returned to GLOBAL_MSG -- an Application Item created in my app.

enter image description here

2. Alert action that displays &GLOBAL_MSG. 3. Close Dialog action

When I run this, the value displayed for GLOBAL_MSG is old.

For example: The first attempt I select 2 records, click "Create Holds" and get an error (the holds are created though).

The second time, I select 3 records, click "Create Holds", and it displays "2 holds created" (the output_msg) from the prior call.

The third time, I select 4 records, click "Create Holds", and it displays "3 holds created"...

I don't understand why step 1 of my Dynamic Action, which has Items to Return set to GLOBAL_MSG, doesn't update that Application Item immediately.

Can anyone tell me how I should be doing this?

Upvotes: 2

Views: 1201

Answers (1)

Scott
Scott

Reputation: 5035

Items to return need to be a page item, but this can be an item on the global page (0).

This is because the concept is returning item values to the client, while an application item (data storage) can just be set within the PL/SQL itself. You should see the session state value is already updated.

Messaging like this usually triggers a dynamic action on change of P0_GLOBAL_MSG, to display an outcome to the user.

The native alert action uses the value from session state at the time of rendering the page. The Alertify plugin, for instance, provides the ability to utilise a client-side value.

alertify plugin action properties

Upvotes: 2

Related Questions