1
0
-1

In many real-world examples, dynamic data service calls can take some time to execute. This is a reality when dealing with 3rd party services that involve a lot of processing.

When a form author begins to build out a prototype or initial version, often the intended dynamic data service is not yet available. In this case, it may be required to "fake" the service call, so that screen layouts can be designed in isolation of any integration activities.

Generally, it is undesirable to call loops which execute a million times, as it can occupy the browser's single thread, and lock up the UI.

Is there a recommended approach to "wait a while" before executing the next line of code?

    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      To add a delay within any rule you can use the angular $timeout service, for example:

      $timeout(10000).then(function() {
        data.status = "Dummy service call completed";
      })

       

       

      You could potentially use this in combination with the

      if (Resource.preview)

       

      test, to ensure that the delay is only executed in the Maestro preview mode, and not in deployed forms

        CommentAdd your comment...
      1.  
        4
        3
        2

        To make that fake call a little more convincing, utilise the showProgress API method to display a meaningful message and busy spinner - call it a second time with a null string to cancel.

        Form.showProgress("Retrieving Details");
        $timeout(5000).then(function() {
            Form.showProgress("");
            Form.goToPage(5, true);
        })

        1. Sacha Trube

          I've always built my own status displays using gif images, visibility rules on advice blocks etc. This method will save me heaps of time on future demos.

        CommentAdd your comment...
      2.  
        2
        1
        0

        From Transact 5.0.1 you could alternatively do this in a Mock Dynamic Data groovy script using the Threads.sleep function and call this function from the form.

        See the Fluent API documentation on Threads for more information.

         

         

          CommentAdd your comment...