LabVIEW Formula Node Does Not Save Values From Last Iteration

Updated Aug 30, 2023

Reported In

Software

  • LabVIEW

Issue Details

I have the following programm code. Since my update to LabVIEW 2019, the output is different.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

Solution

The behavior of the Formula node was changed in LabVIEW 2019 to reflect the general LabVIEW Dataflow.

LabVIEW 2019 and newer
Before each iteration, the output value is initialized with the standard value.
If the IF condition is met, the value is changed.
If the IF condition is not met, the value stays the standard value.
 
Provided Code Snippet will produce the following result in LabVIEW 2019 and onwards:
Loop IterationInputOutput
000
111
200
311
 
In order to reproduce the "old" behavior, you have to rewrite your code, for example with shift registers.


LabVIEW 2018 and earlier
Before the first iteration of the while loop, the output value is initialized with the standard value for the data type.
Later, the value is only changed, if the IF condition is met.
If the IF condition is not met, the output value from the last iteration is used. 

Provided Code Snippet will produce the following result in LabVIEW 2018 and earlier:
Loop IterationInputOutput
000
111
201
311

Additional Information

A workaround for reproducing the "old" behavior where the output keeps the value from the last iteration, is to wire the output for which you want to keep the value directly to an input for the same variable using a feedback node. The resulting VI for the provided example should look something like this:
 
Workaround.png