Auto-refresh Local Variable via Asynchronous Process

All,

Let's say I have an interface with a button widget, which triggers an asynchronous process (i.e., a!startProcess). There's also a local variable (let's call it local!myVar) that is initially empty. My goal is to display the value of this variable when it's updated. The asynchronous process is to determine what value gets assigned to this local variable. And I'm looking for ways to display this value without having to reload/leave the interface.

From what I understand, the use of a!refreshVariable() is probably the best way to make this work, but I'm having some difficulties figuring out how to pass a dynamically assigned value within the asynchronous process back to the interface.

Any tips/pointers will be much appreciated!

  Discussion posts and replies are publicly visible

Parents
  • Big thanks to all who responded to this posting - I found the replies really helpful!

    I think I'm getting close to finding a suitable solution for my need, but here's one final bit of "need" that initially didn't seem that relevant:

    The said asynchronous process involves interactions with an external system. The short end is that the external system will return a Boolean value at the end of the interaction. That's why I stated that it might take a few minutes before the value assignment can happen, but an edge case scenario also warrants the possibility of this handshake taking as long as a few hours.

    A few additional comments:

    • I could have the resulting value be written to the database to make it available for retrieval if necessary, but that isn't part of my approach at this point.
    • Using a plug-in is also an option, but one that I'd like to avoid if at all possible.
    • I'm thinking I should be using the refreshInterval option for a!refreshVariable given the expected delay in getting the value.

    cc:

  • I think given your additional comments, my recommendation still stands. Using a!refreshVariable() and a!queryProcessAnalytics() will allow you to asynchronously access the data and you don't have to write to the database. It can be a little tedious to get it to work though, so please feel free to respond with questions.

Reply Children
No Data