10-28-2016 06:00 PM
Hi,
I hope i can explain this well enough, i have a subvi that has a string input, it reads the string and processes it. this subvi gets called quite a few times. each time with a different input, now i need to call it/run it and have it remember the previous input and merge it with a new input. i can deal with that part easy enough with a boolean input so i can switch between the current input or the previous input + new input. its getting the previous input data i am struggling with, i cant read control because it will read the new input i am sending it. i hope your still with me!
can anyone suggest a way to do this? i guess i could use a global variable, but i always hear people say to stay away from them.
Thanks
10-28-2016 06:09 PM
Perhaps a feedback node is what you're looking for.
10-28-2016 08:16 PM
I, personally, find feedback nodes more complicated than a "Do Once" While Loop with a Shift Register that "remembers" the previous call. You make it "do once" by wiring a True constant to its Stop terminal. Here's a picture (I know, I say "Don't post pictures ...", but I wanted to put in a label ...
I hope this isn't the first time you've seen something like this. If it is, just try to code it up and run it a few times, putting an indicator on the Shift Register terminal shown as "Last Input". If you run with Highlight Execution (the little light-bulb) turned on, it should be crystal clear how this works.
Bob Schor
10-29-2016 01:33 PM
Thanks for your advice, i am fully aware of using the shift register and how you can retrieve the previous data by dragging down the shift register arrow on the riaght hand side. i cannot use this in the vi i am using. i have never used a feedback node so i will have a play with that.
thanks