Search code examples
dynamicactionoracle-apexpageloadoracle-apex-5

Oracle APEX Dynamic Action PageLoad Processing


Situation: I currently have a page that is a type of Dashboard page. It contains several charts and reports. This page is the home page of the application. When the page first loads a Request Type of First is passed into the page. As the page renders several page processes calling Oracle Package, setting values, etc are executed. Once the page processes are complete, i believe the dynamic actions are then fired off. There are probably 10 DA's that are fired on PageLoad. The very first DA is fires on PageLoad but has a condition of REQUEST = 'First'. If condition is met, the page is then resubmitted with a Request Type of: search.

Question: How does APEX process Dynamic Actions, specifically PageLoad? If there are 10 Dynamic Actions all sequences are greater then another, does APEX or Page Processing handle one at a time or do they all execute at the same time regardless of sequence and conditions?

Reason for Question: I created a DA to execute an insert statement into a DB Table. This DA executes on page load with no conditions and is sequence#: 0. Then, i created another DA to do the same but is the very last sequence#. When logged into the application and then viewed the data inserted into the DB table, it showed both records 4 times. the first two were inserted when request type = First. Then the DA already mentioned fired and resubmitted the page which then inserted two more records. I was only expecting three records to be in the DB Table. One for the request type First and two for the request type search.


Solution

  • Why are you using dynamic actions? Why not use processes that execute during page render?

    Dynamic action execute order can't be guaranteed in that way, in the same way has a JavaScript loop behaves like nothing you'd think. JavaScript does it's own thing.

    If you're executing PL/SQL in your dynamic actions, this will behave synchronously or asynchronously. Either way, they will be launched with x separate processes. The only way to control order would be to have them in the same dynamic action and 'wait for result' set to yes.

    Which brings me back to: why use dynamic actions?