07-13-2021 05:11 AM
Hi All,
I have a bit of a problem displaying a large(-ish) number of booleans decoded from a decimal number.
Getting the signals out and turning the boolean ON is not a problem but what does cause me trouble is is having them turn off when they're no longer relevant...
I'm using a couple of condition structures one within another.
I've found a couple of topics talking about using local variables before and after the loop in order to set them to 0.
While that probably works, we're talking about dozens of booleans so that's pretty incovenient.
Is there a way to do this conveniently?
07-13-2021 05:28 AM
@marc426 wrote:Is there a way to do this conveniently?
1) Group the Booleans in a cluster or array. Then it's only one local, or one for each cluster or array.
2) You can do this with VI Server. Get all control references from your front panel (VI.Front Panel.All Controls[]), then filter on Boolean type or label. Use Value property to set the values.
The way this seems to be going is that you have a sub VI that keeps evolving into an application... This will go bad at some point. You should start to think about application structure. Start dividing functionality into sub VIs, libraries, classes, etc.. Setting the Booleans to a value and resetting the Booleans are two functions and should be in two sub VIs. With VI Server you can do that.
07-13-2021 05:37 AM
Hi Marc,
@marc426 wrote:
Getting the signals out and turning the boolean ON is not a problem but what does cause me trouble is is having them turn off when they're no longer relevant...
I'm using a couple of condition structures one within another.
I've found a couple of topics talking about using local variables before and after the loop in order to set them to 0.
While that probably works, we're talking about dozens of booleans so that's pretty incovenient.
Is there a way to do this conveniently?
Surely there is a convenient way…
You "just" need to organize all those boolean indicators in a more appropriate way!
In the end it boils down to "organize your data structures in a better way"!
07-13-2021 11:04 AM
You've already got some good advice, but you definitely have general architectural problems due to poor design. If you have indicator terminals in innermost structures wired to TRUE constants, there is no good way to ever reset them if the inputs change. All indicators need to update with every run, so they belong all the way after all the conditional parts.
Yes, use clusters from logical sets of indicators. I also see great potential to simplify your code in general.
07-13-2021 11:35 AM - edited 07-13-2021 11:38 AM
Frankly I don't understand what you are doing with your indicators...
The most coinvent way to handle this would be to try a different front panel layout so you can leave everything in an Array and just update it as required.
I know it's a P.I.T.A. but you can get all your labels to line up to an Array indicator and make the array "container" transparent.