From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-28-2015 12:09 PM
I have a text ring in which a select an item. What I want is to be able to run the application a single time with the run button, and add multiple items, so that they appear one after the other in a list downwards.
I will leave as an attachment what I have so far.
Any examples, and code will be greatly appreciated.
Thanks.
01-28-2015 12:49 PM - edited 01-28-2015 12:57 PM
Two things:
Shift Register
Concatenate String
EDIT:
I see you have these in your code, but your architecture is overall, messed up. You need a while loop. The 1 iteration For Loop is pointless. The case structure needs to be inside the while loop.
Do you want to build a string or an array? Pick one or the other and stop dancing between both.
If you do use an array, don't use Insert into Array. It is the wrong function 99% of the time. The correct function when putting data at the beginning or end of an array is Build Array.
01-28-2015 01:16 PM
The reason why "Insert into array" is wrong is that it resizes the array in memory. This means that LabVIEW needs to spend extra time reordering things in memory so that the array has room to grow. It has to do this every single loop iteration. Build array doesn't do heavy shifting around like this, and so it will operate far, far faster.
I am also confused as to why you have a foor loop with 1 iteration and a shift register. A couple extra comments/questions...
Why are you initializing to 0 and manually adding 1 in a shift register? That is what your loop iteration count already does (the blue I in your lower left corner)
Why are you bothering with an array at all? Every line just concatenate 3 items: Current text + cr/lf + new text.
01-28-2015 01:17 PM
I already fixed it.
01-28-2015 01:34 PM
@Nando88 wrote:
I already fixed it.
I would hardly call that "Fixed"...
Some more comments:
01-28-2015 04:11 PM
Here is a modified VI that does what you are trying to do, with all the unnecessary code deleted.
01-28-2015 04:14 PM
@BowenM wrote:
I would hardly call that "Fixed"...
(Long list of comments)
In addition:
In any case, here's a quick rewrite of your VI showing some possible simplifications. See if it makes sense.
As has been mentioned, you should use event structures, so modify as needed.
01-29-2015 06:54 PM - edited 01-29-2015 06:55 PM
Thanks for the code.
I made some changes to it, now I'm trying to print the results in a table.
The problem I'm having is that the second text ring will not update, and the second time I try to change the first text ring, the app crashes and stops responding.
Can some one please help me?
I'll leave the code I'm using.
Thanks!
01-29-2015 08:16 PM
Two event structures in the same while loop. BAD idea.
On top of that, all your event cases in both structures are set to Lock the Front Panel until the event completes. So if your code is waiting for an event in event structure #1, and you fire an event that is registered in event structure #2, your front panel will lock up. You'll never be able to trigger an event registered in #1 to get the code to continue executing.
Try using timeouts. Try setting all the event cases to not lock the front panel. It may start behaving. But I still wouldn't recommend it. The architecture is still set up wrong.
Read Caveats and Recommendations when Using Events in LabVIEW - LabVIEW 2013 Help
01-30-2015 12:39 PM
I removed the event structure for the text ring, but the second text ring still will not update.
Can someone please help me?
Thanks.