I'm trying to set values of boolean indicators located inside a cluster control but for some reason, labview doesn't change the value of the specific control that I'm trying to set even though the code executes correctly. Instead, a different indicator changes. I created a reference of controls and I'm using property nodes to manipulate the boolean values. After deleting the initial indicators and creating new ones, the new controls do not change at all when I try to set their values. Does anyone know what might be causing this? Please see attached code.
Your code is a bit convoluted, but you've written it such that if a boolean starts out TRUE, you write TRUE to it (so you see no change). If all booleans start out FALSE, then you write FALSE to all booleans (and still see no change).
Your code does exactly what it is programmed to do, just not what you want it to do...
Be careful when indexing through clusters, you might not have your controls in the order they appear visually. Right click on your cluster and select "Reorder Controls In Cluster..." and you will notice that switches b7 and b8 are lower index then switch b5 and b6.
Why not split the array of controls, get the values from the switches, then write to the displays. (You could do this all in the same For loop too)
My question is "What are you really trying to do, and Why do it this way?". It seems (to me) that at one level, you want to have a Boolean Array of Controls and know the State of each of them, allowing each to be changed by toggling the respective controls.
Here's an example -- this is a 2D array of Boolean Controls that will "light up" if pressed. The attached code runs until you turn all of the switches on.
Here's what I would probably do...
Of course you could micromanage and add more code so only the changed indicator gets written, but it simply is not worth the effort. Note that I made the LEDs "disabled (not grayed)" so they act as indicators and cannot be operated even thought the cluster is a control.
Thanks everyone for all your suggestions. Yes, indexing out of the cluster was causing the problem because the controls were not in the correct order. I will take your suggestion and split the array of controls and then write to the indicators.