03-24-2015 10:20 AM
Note: values of Controls on the connector pane are *not* preserved between calls. If wired, they receive the value wired in. If unwired, they revert to default value.
I'm not 100% certain what happens with controls that aren't on the connector pane, they may well preserve their value but since they aren't wired, their preserved value and their default value are likely the same anyway.
-Kevin P
03-24-2015 10:28 AM
Controls that are not connected to connector pane terminals do retain their values in between calls so long as they remained in memory.
03-24-2015 11:45 AM
JonP wrote:
My personal conclusion: A guiding principle in my lengthy software experience (not so lengthy with LV as you can probably tell!) is to keep the code as simple as possible. In the case of a simple Get/Set FGV (no need to read the indicator) I think using the indicator is the simplest solution but I agree that for anything else the single-iteration loop (how can that not be a kludge) with a shift register or, a bit better, use of a feedback node is probably best.
In the case of a Get/Set FGV, the simpleest solution is to just use a Global Variable instead of the FGV. It performs a lot better and the Get/Set FGV does nothing to help the issues with a global.
03-24-2015 12:06 PM
Yes, that's a good point, although there can still be benefits to using an FGV, for example if you store multiple values that are dependent on each other or if you have to perform some operation on the data before returning it (in which case I guess it ceases to be a simple get/set FGV I suppose, although it is simple enough that I would still implement it my way).
03-24-2015 01:30 PM
I'm in "partial agreement" with your conclusion. Several years ago, I proposed adding a "Do Once" loop to the Structures palette specifically to allow you to have shift registers ("memory") for Action Engines and Functional Globals. When I try to tell students about wiring True to the Stop terminal of a While loop, their eyes glaze over ... Needless to say, this was largely pooh-poohed (though one NI Guru Who Shall Remain Nameless was sympathetic), with Feedback loops being touted. However, I must admit that I find that a feedback loop representation of a FGV is nowhere near as "intuitive" as a While+Stop+Shift Register construction ...
Bob Schor
03-24-2015 01:58 PM
@Bob_Schor wrote:
Needless to say, this was largely pooh-poohed (though one NI Guru Who Shall Remain Nameless was sympathetic), with Feedback loops being touted. However, I must admit that I find that a feedback loop representation of a FGV is nowhere near as "intuitive" as a While+Stop+Shift Register construction ...
This has been a long debate between Stephen (hates feedback nodes) and Darren (loves feedback nodes). Personally, I like the feedback nodes. But to each their own.