4 Replies Latest reply: Sep 6, 2013 12:25 PM by V Rickert RSS

    APEX Validations - Do Processes execute even if validations fail?

    V Rickert

      HELP!!!!

      My question is:

      If I have several validations and one of them fails, do the page processes below them get executed or are they bypassed, waiting for the validations to pass?  I have two processes called Update_MthYr and UpdateInvoiceTotal declared as PL/SQL anonymous Blocks that are called and executed after the APPLYMRU and APPLYMRD processes in a Master/Detail form.  Do these processes get called anyway even if a validation fails?

      The processes update the Detail table with calculated information.  I am afraid that the failed validation process is not keeping the page processes from executing thereby causing a COMMIT and then the associated  'Current version of data in database has changed since user initiated update process.' error when I try to update a field on the detail portion of the page.

      What do you think?

      Should these processes be called in triggers instead?

      Can I call procedures to update the same table that the trigger is based on?  Ex.  Procedure updates Vendor_detail and Trigger is associated with Vendor_detail.

        • 1. Re: APEX Validations - Do Processes execute even if validations fail?
          Ramesh P, Oracle APEX Developer

          Hi,

          Here is what happens when a page gets submitted.

           

          First the computations in the page process or middle block of the page gets executed. (After all the computations executed without any errors), then it goes do validations block

           

          If the validations gets executed based on conditions, and if the validations raises an error then the further processing of the page is stopped.

          (All the validations are executed first and if none of them raises any errors then it goes to page processes. If any one of the validations raises error or all of them or some of them raises error then it stops further processing of the page.

           

          Once page is submitted here are the sequence or flow of actions and lets make it simple and all are after page submit

           

          Compuations

           

          Validations

           

          If validations are successful then => Page Processes

           

          Branching (If any)

          • 2. Re: APEX Validations - Do Processes execute even if validations fail?
            V Rickert

            Well that is good to know.  But then the question becomes: why does my page give me "Current version of data in database has changed since user initiated update process" when I try to change a field in a detail row?  There is no other user updating the same row.  I can get out of that invoice detail page altogether. Re-retrieve the invoice number and try the same update and get the same error message.  What could possibly cause this error?  I am at wits end!  I was hoping that it was calculations that I was doing in the processes section and the commit was causing the problem.  What about calculations done before ApplyMRU process?  Could a calculation before the process be the culprit?

            • 3. Re: APEX Validations - Do Processes execute even if validations fail?
              Tom Petrus

              If you apply any dml to the same table that is defined in your multi-row-process BEFORE it executes then you will run into the checksum error. A checksum is generated during page render based on the current values of the fields of the fetched row. When the page submits and it comes to the MRP it will then create a checksum again, based on the current values of the row in the database. If that value matches the one that was generated at page render then the engine knows no changes will be lost or overwritten and it will process the submitted values. Obviously, if you alter values on the row in the database before the process fires, then the checksum it will generate will differ from the submitted one, causing a checksum error.

              • 4. Re: APEX Validations - Do Processes execute even if validations fail?
                V Rickert

                Yes, I have reviewed where I am doing the calculations and it is AFTER the ApplyMRU and ApplyMRD processes.  This is so frustrating!    But the calculations update totals in the Invoice Table.  My Master/Detail is based on the Invoice as the Master and then Invoice_Details as the detail portion of the page.  If I execute the page process after the APPLYMRU and then want to process something on the same page again, I get the error.  It could be that the invoice data is now different because it was not typed in from the form but updated through a background process?