LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Populating Cluster of Controls

Solved!
Go to solution

Hello everyone, I am using LabVIEW2011 (no laughing 😉 )

 

Background:

I am writing a program that is going to read all the values from TCP  connected instrument (as string) and then allow the instrument values to be updated from the program. I will also be reading measurements from the instrument and bundling them into the cluster. Different data types will be present

The result will be typ def.  cluster with about 20-30 controls. Most of the program will bundle or unbundle a few parts of the cluster at a time which is not a problem.

 

The question:

The initial population of the cluster controls, and any "dumping" of control values to the instrument to update settings has me asking "Am I doing this the best way" I wanted to have a string array of all the TCP commands go into a FOR loop and stuff into the bundle one by one. Once I read a string value from the instrument, I need a way to address a control in a cluster based on a string read from an array. Once I pick the control I want, I want to convert the data to the control's data type. (string, boolean, enum)

 

I am good with the array functions, the shift register, everything but

1. programatically "adrdessing" a control in a cluster to select where to bundle

2. detecting the data type of that control once I get it. (I figure a property node)

 

 

bitmap.png

 

I hope I gave enough information to have this make sense. I made a mock snippet explaining what I want to do in psuedo code.

I appreciate everyone's constructive input. Thank you!

Download All
0 Kudos
Message 1 of 4
(752 Views)

as a quick response without putting too much thinking on it, one way is:

 

to use a case structure  with the column 1 with the TCP command and for each command (each case) have a unbundle/bundle structure to conver the second column to the appropriate type on the cluster structure. 

 

0 Kudos
Message 2 of 4
(713 Views)
Solution
Accepted by topic author MontgomeryScott

LVNinja_0-1695835621143.png

 

Message 3 of 4
(709 Views)

I got something similar to what you did, and it works. I was hoping to just add to the array for fast and flexible additions to code. With this way I need to add a case for each command I add. The pro is that I can handle data types for each case. The con is I need to create a case for every element in the array. In the end its a much simpler way of doing it, which probably makes it the right way! Thanks!

 

snippet.png

0 Kudos
Message 4 of 4
(688 Views)