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 Reply Children
  • 0
    Certified Lead Developer
    in reply to SailingHome
    Doesn't the use of activity chaining equate to leaving the interface?

    a!startProcess isn't strictly "asynchronous" in the way you're thinking.  While it does fire off an instance of the target process without leaving the current interface, the interface itself waits for any chaining to end or be otherwise resolved before it returns the onSuccess parameter info. 

    In this way, chaining can be leveraged to assist in setting the value of one of your local variables with the value of in-process data (nominally at whatever value that PV holds when chaining ends or the process terminates, whichever comes first).

    If the value assignment in the asynchronous process happens a few minutes after the button is clicked

    For this use case, you would need to use some other method of pulling back the process data in question. Particularly, if the data you're expecting takes "a few minutes", then we wouldn't be talking about a process with chaining through it (unless you plan on running some sort of query or expression logic that takes a few minutes to run?).