Workspace 6.21.5
|
This operation effectively decouples the main output from the main (ie value) input. Any request for the main output will result in a cached value being provided. The cached value is only updated after something causes the Trigger input to become not up to date.
Initially, the cached value will simply be the default value for the data type being used. Thus, the main input is not updated the first time the operation updates, which is a main difference between this operation and CacheData. The cached value will also be reset to the default for the data type whenever the data type of the operation is changed.
One of the more common uses of this operation is to place it at the end of a workflow and attach a push button widget to the Trigger input. The workflow is attached to the main input of the operation. With this arrangement, the workflow upstream of the UpdateBarrier will only execute when the user presses the push button, and it will only execute once. It will not re-execute until the user presses the button again (and then only if something in the workflow changed, as per normal workspace updating dependency behaviour). Basically, you end up with a "run the workflow once when I press the button" arrangement, which is sometimes referred to as a "one-shot" update.
This tutorial will cover ...
Just in case you get stuck, a sample workflow has been provided for you.
To construct the first example,
Add some display widgets to your Workspace:
If you select the Variable operation, your Workspace should now look something like this, with the two connected display widgets docked on the right-hand-side of the screen
Now, if you execute this workspace you may expect the Variable's value of "Hello Workspace" to be displayed in the QLineEdit widget attached to the UpdateBarrier (again, shown as Update Barrier --> Value
in the right column). However when you do execute the Workspace only an empty string shown in the QLineEdit widget and the Variable's status indicator does not go green.
While the Workspace is executing you can then click on the "Reset" button connected to the UpdateBarrier (again, shown as Update Barrier --> Trigger
). Now we see the value of "Hello Worldspace" in the QLineEdit.
The UpdateBarriers operation allows a particular branch of a workflow to be executed once and only when the user specifically triggers an update. Normally, a push button widget is attached to the Trigger input of the operation. When the button is pushed, only then will the Value input be brought up to date, have its date cloned and that cloned data stored in the Value output. Thereafter, any time the output data is needed, the cloned data is supplied, even if the Value input becomes not up to date. Only when the user presses the button that invalidates the Trigger input again will the Value input be brought up to date once more.
The UpdateBarrier operation can be thought of as a "one-shot" trigger. It gives the user the ability to have a part of their workflow execute only once and only when they specifically ask for it to be executed. Note that normal workspace execution rules apply in the workflow connected to the Value input, however, meaning that if the workflow branch is brought up to date once and nothing is ever changed within that branch after that, then triggering the Trigger input will not cause the branch to re-execute.
An important feature of this operation is that the first time the output is requested, the Value input is not brought up to date. Instead, the default value for the data type will be supplied at the output. This default value will continue to be supplied until the Trigger input is invalidated as described above. When "enabled" is set to false this operation acts like a regular passthough variable. This enables this trigger to be used as a toggle.
This concludes the tutorial on datatype conversion. We have now learned how to:
A sample workflow for this tutorial can be found here.