LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to update a control in a cluster programmatically?

Solved!
Go to solution

I created a simple state machine. All I want to do is to feed 5 to "control 1" in the next state (Reset control 1).

Do you think it's even possible with my approach?

I have the habit to keep my code organized by placing my controls in a cluster, maybe it's a bad idea in the first place if I want to achieve what I'm trying to achieve. Any correction, feedback, constructive criticism?

0 Kudos
Message 1 of 5
(1,242 Views)

Hi GRCK,

 


@GRCK5000 wrote:

I created a simple state machine. All I want to do is to feed 5 to "control 1" in the next state (Reset control 1).

Do you think it's even possible with my approach?


Yes, that's possible!

 

You already know how to set the whole cluster using a local variable.

You already know how to use BundleByName to change one item in the cluster.

Why don't you combine your knowledge to get the solution???

 


@GRCK5000 wrote:

I have the habit to keep my code organized by placing my controls in a cluster, maybe it's a bad idea in the first place if I want to achieve what I'm trying to achieve. Any correction, feedback, constructive criticism?


Clusters are good to bundle related items.

Are all your items related?

Should the user be able to edit items in the cluster? Should the cluster be an indicator instead?

Does the user like it when your program may overwrite what the user was editing? (Might be bad UX!)

 

Conclusion: it might be a good idea to give the intended overall use case instead of focusing on that little behaviour question…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(1,235 Views)

Thank you. I found the solution. Hahahah

0 Kudos
Message 3 of 5
(1,227 Views)
Solution
Accepted by topic author GRCK5000

Your code is just plain silly.

 

  • Why are diagram and front panel so gigantic?
  • Your entry limits can be set once outside the loop. No need to rewrite them 10x per second.
  • One property node is sufficient for both properties.
  • Once the limits are set, they will be saved with the VI. No need for these property nodes at all!
  • Don't call a state "addition" if no addition is taking place.
  • Wring the diagram constant to the local variable and to the while loop is still a race condition, because the wire branching allows both dependencies to start at the same time. You cannot guarantee that the controls are set to a defined state before the terminal in the loop is read.
  • I can't see any reason for the lower output tunnel. If you plan to use that later, it should probably received the reset value, not the stale value the cluster had before the case.

 

Here's functionally equivaled code:

 

altenbach_0-1673542841520.png

 

  •  
Message 4 of 5
(1,205 Views)

Thanks Mr. Altenbach for your feedback! Hopefully  One day, I will get just one remark from you. Haha. I'll have a big party 😂.

0 Kudos
Message 5 of 5
(1,178 Views)