8 Replies Latest reply: Nov 15, 2012 7:13 AM by fac586 RSS

    What is the evaluation order of Page Items

    731104
      I just wonder what the execution order of page item assignments are in the page rendering process.
      Sequence (+ Region), Type of items, more clever by checking dependencies ??
      I couldn't find anything here, or looked with the wrong keywords.

      I just need to know, what reliable assumption to make about dependencies amongst page items?

      Is that visible in the APEX code? A pointer to that would be OK.

      Many thanks
      Thomas
        • 1. Re: What is the evaluation order of Page Items
          fac586
          t-o-b wrote:
          I just wonder what the execution order of page item assignments are in the page rendering process.
          Sequence (+ Region), Type of items, more clever by checking dependencies ??
          What do you mean by "assignments"?

          Items are rendered in order of region position/region sequence/item sequence. Item values will be evaluated in this order, but may also be set by computations or processes which run in order of processing point/computation sequence/process sequence.

          You can view page components in event order in the App Builder by selecting the Utilities > Page Events view in the page definition, and the actual sequence of runtime events in the debug trace.
          • 2. Re: What is the evaluation order of Page Items
            Howard (... in Training)
            Thomas,

            Hello. I hope I don't wander off into things I don't yet know about here. ... If you are looking at the edit page "tree" view, you should find that page rendering (evaluation) is down the tree, that is, top to bottom. And in English, that corresponds to the page being constructed top to bottom, left to right. Type of regions and items is not a factor. It's purely by order of the element and order is determined by the sequence number assigned. So if you have 4 items, they are initially assigned sequence numbers 10, 20, 30, 40 -- which you can change to reorder the items. But you've been around long enough that you must have a deeper question than I'm not seeing here. (Of course, Dynamic Actions are executed when triggered.)

            So, what more are you looking for.

            Rgards,
            Howard
            • 3. Re: What is the evaluation order of Page Items
              731104
              fac586 wrote:

              What do you mean by "assignments"?
              The "Source" ("Source value or expression" in combination with the "Source Type") on the Page Item [Application Express 4.1.0.00.32]
              fac586 wrote:
              Items are rendered in order of region position/region sequence/item sequence. Item values will be evaluated in this order, but may also be set by computations or processes which run in order of processing point/computation sequence/process sequence.

              You can view page components in event order in the App Builder by selecting the Utilities > Page Events view in the page definition, and the actual sequence of runtime events in the debug trace.
              That was exactly what I was thinking, but that is not the case as far as I can tell. The order which is shown "*Utilities > Page Events*" seems to be the display order, but not necessarily the evaluation order in order to obtain the values.

              I have a database field that is shown much further down in this sequence, but I have a dependent field that is calculated based on this value and is shown before in that sequence.

              So I was wondering whether there is an implied order - possibly based on the Source Type of the page item.

              And to answer the question. There are no other computations or processes ... other than the associated "Automated Row Fetch" related to the database column used in the page items on the page.
              • 4. Re: What is the evaluation order of Page Items
                731104
                Hi Howard,

                I hope the reply to the other poster makes it clear. There seems to be a difference between the order in which the page items are rendered and the order in which these are evaluated.

                I was making the same assumption as you, but I accidentally re-ordered the sequence and a dependent item further up in the tree was correct.

                My assumption was that this has to do with the Source Type, i.e. database column types first, then, ... I was just wondering whether there are reliable defined semantics for the execution order.
                I may have not phrased my question accordingly.

                Regards,
                - Thomas
                • 5. Re: What is the evaluation order of Page Items
                  Patrick Wolf-Oracle
                  Hi,

                  if you have a "Automated Row Fetch" process, then APEX will populate the session state of all page items where source type = "DB Column" when the process is executed.

                  All other page item source types are populated in the sequence the page items are rendered.

                  Regards
                  Patrick
                  -----------
                  My Blog: http://www.inside-oracle-apex.com
                  APEX Plug-Ins: http://apex.oracle.com/plugins
                  Twitter: http://www.twitter.com/patrickwolf

                  Edited by: Patrick Wolf on Nov 15, 2012 1:47 PM
                  • 6. Re: What is the evaluation order of Page Items
                    731104
                    Thanks - that explains the behaviour so the Automated Row Fetch does not only retrieve the row, but assigns as well all page items that refer to that.
                    • 7. Re: What is the evaluation order of Page Items
                      Howard (... in Training)
                      Patrick,

                      Great. Very good to know. I've wished for a tutorial which gives the notional (mental?) model of how APEX operates. Since it couldn't cover everything, I'd be looking for a description of 1) what "usually" happens and 2) common "gotchas". This might be one of those "gotchas".

                      Best regards,
                      Howard
                      • 8. Re: What is the evaluation order of Page Items
                        fac586
                        t-o-b wrote:

                        I have a database field that is shown much further down in this sequence, but I have a dependent field that is calculated based on this value and is shown before in that sequence.

                        So I was wondering whether there is an implied order - possibly based on the Source Type of the page item.

                        And to answer the question. There are no other computations or processes ... other than the associated "Automated Row Fetch" related to the database column used in the page items on the page.
                        See above:
                        but may also be set by computations or processes which run in order of processing point/computation sequence/process sequence.
                        The ARF process would be an instance of such a process.