09-27-2023 10:08 AM
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)
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!
Solved! Go to Solution.
09-27-2023 12:25 PM
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.
09-27-2023 12:27 PM
09-27-2023 12:57 PM
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!