Wait timer in interface or Expression rule

I am just trying to explore is there any way to wait(hault the execution of code for specific duration), like we have in process model or similar like Java sleep function

Thanks

Pratiksha

  Discussion posts and replies are publicly visible

Parents Reply Children
  • So...I think the answer is 'Yes' but it's a little convoluted...or, at least, harder than perhaps it should be...

    1. you'll need to implement a refresh variable set to auto-refresh after 1 (that is, one minute)
    2. the value of that variable should be ultimately sourced from a value in a database table, but sourced via a Stored Procedure - use the a!executeStoredProcedureForQuery() - note that the documentation says you shouldn't use this for update but in this case the use case is warranted and safe 
    3. the value is initialized in the database before the User Interface is first loaded - that is, write as part of the upstream process. If you set this to zero and have the Stored Procedure increment it by 1 each time then you can use the returned value to control  the visibility of the link component
    4. your link component will have a showWhen attribute that you can set using 'local!refreshVal > 1' which will initially evaluate to false but will evaluate to true after the autoRefresh has run

    As I said, harder than it should be but should work.

  • yeah thank you for the reply but it didnt work may be I made a mistake in implementation

  • 0
    Certified Lead Developer
    in reply to Stewart Burchell

    I'd second the "timed refresh variable" approach (note that you can use the "half minute" version if 1 minute is too long), but i'm super unclear why stored procedures come into this example at all.  For my purposes it's been sufficient to set a refresh variable to capture the current timestamp and periodically compare it to an original set to ("load time + 1 hour") for example, after which the download link is disabled in my case (as the link references an excel file that was generated by a background process which gets auto-deleted after an hour). It works flawlessly for me, FWIW.