4 Replies Latest reply on Dec 20, 2018 7:11 AM by Fabrizio Delli Priscoli

    show a confirmation message in a process

    Fabrizio Delli Priscoli

      Hi all, I'm newbie in APEX.

      I'm on APEX 18.2 and here is my scenario.

      I have 3 items, "year", "month" and button "find data"; user enter year and month and then press button to find records for year and month he has inserted submitting the page.

      I have a process that make a select from the table for that year and that month and if there are no records this process provides to insert record in the table and display them in an intercative report.

      If there are records in the table I want to display a confirmation message to the user asking if he wants to delete actual records in the table or not.

      If user press "delete and reinsert" option of my confirmation message, process must first delete the actual records for year/month and then reinsert them.

      If user press "don't delete" option, process must only display the actual records.

      So how can I display the confirmation message inside the process, that is type PL/SQL code ?

      Thanks in advance for collaboration.

      Fabrizio

        • 1. Re: show a confirmation message in a process
          Mike Kutz

          My Concerns

          "Multi-users" usage could potentially allow one user to overwrite what another user chooses.

           

          APEX Design Note

          Once you start a Process, it must complete completely or it must fail completely.  There is no method for "interaction" once you start a Process.

           

          Potential Workaround

          Follow these steps

          1. Use a Dynamic Action to see if "data is there or not" (do not do DML)
          2. pop up a message/ask question based on results
          3. save result in a HIDDEN ITEM (or set the Action)
          4. Auto submit page to Process the data.

           

          My $0.02

           

          MK

          • 2. Re: show a confirmation message in a process
            Fabrizio Delli Priscoli

            Hi mike, thanks for your help, I think it is correct and I will try it.

            Thanks again,

            Fabrizio

            • 3. Re: show a confirmation message in a process
              fac586

              Fabrizio Delli Priscoli wrote:

               

              I'm on APEX 18.2 and here is my scenario.

              I have 3 items, "year", "month" and button "find data"; user enter year and month and then press button to find records for year and month he has inserted submitting the page.

              I have a process that make a select from the table for that year and that month and if there are no records this process provides to insert record in the table and display them in an intercative report.

              If there are records in the table I want to display a confirmation message to the user asking if he wants to delete actual records in the table or not.

              If user press "delete and reinsert" option of my confirmation message, process must first delete the actual records for year/month and then reinsert them.

              If user press "don't delete" option, process must only display the actual records.

              So how can I display the confirmation message inside the process, that is type PL/SQL code ?

              You can't. APEX is not Oracle Forms. That is not how APEX (and web applications in general) actually work. Here is a simplified model:

               

              BrowserRequest page
              ServerPage show processing
              BrowserRendering
              Initialization
              User interaction
              Submit page
              Server

              Page accept processing

              • computations
              • validations
              • processes
              • branches

               

              On completion of page accept processing, APEX starts the cycle again by branching to perform page show processing for the same or another page. User interaction with the application can only occur in the browser after the page is rendered and event handlers required by APEX components and dynamic actions have been initialized. There is no way for the user to interrupt or interact with page accept processing after the page is submitted.

               

              Any requirement for users to react to partially processed data must be designed into the application, typically by using separate pages to create multi-stage wizards, with intermediate results being stored in APEX collections.

              • 4. Re: show a confirmation message in a process
                Fabrizio Delli Priscoli

                Hi all, I have resolved in this way.

                Under button "find data" I have 2 dynamic actions.

                One check if data are stored in table... to achieve this under "Server-side Condition" property I have set "type" with "No Rows Selected" and in the SQL query box I have put the query to check.

                Then under true node I have put a submit page and I have a process that provide to insert record directly without providing a delete action.

                 

                The other dynamic action is similar to the previous one and checks if there are records on table... to achieve this under "Server-side Condition" property I have set "type" with "Rows returned" and in the SQL query box I have put the query to check if there are records.

                Then under true node I have put "Execute Javascript code" and in the code box I have recall the apex.confirm function, passing the text of my message and the value using for firing the process. Under process I have created a process with property "type" = "Request = Value", and set the property "Value" with the value used in the apex.confirm function.

                In this process first i make a delete action to delete records for year-month and then I make the insert statement.

                 

                Hope that this can help someone.

                 

                Fabrizio