LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting data from a Cluster to an Array to a series of Strings

Solved!
Go to solution

Hi all,

 

I have an app that pulls testing parameters from multiple access database tables.  I would like to take the parameters and print out a report so that any particular test lot can be reviewed with the parameters that it was tested against.  Sounds simple enough but there is a caveat. 

 

The database allows for a multitude of various parameters and only a few are populated with information based on the particular part number being tested.  I am already pulling the info into LV in a typ def cluster format to supply the test engine with the correct variables.

 

I have created a routine to convert the cluster into an array, parse the array to strip away any empty or zero fields to end up with an array that is only as long as the number of original populated fields in the cluster.  Now, I am stuck on getting this information back into a format where I can end up with both the field name and the data so that I can create a simple report to show what test parameters were used for any given lot of product.

 

Sounds convoluted I know so I have created an example and attached it for reference,  The included source cluster is a constant that simulates what might be pulled from my database table.  A few fields are populated and most are not.

 

Any thoughts are much appreciated.

 

Doug

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 1 of 4
(2,367 Views)
Solution
Accepted by topic author dacad

The OpenG function "Get Cluster Element Names" is exactly what you're looking for.  Input a cluster and it'll output an array of strings of the names of the cluster elements.  Parse that array at the same time as your numeric array and you'll be set.

 

You can improve your array parsing as well.  For example, you don't need to explicitly index the array - the for loop does that automatically for you.  Also keep in mind that dynamically sized arrays are not terribly memory efficient if this is a concern.

0 Kudos
Message 2 of 4
(2,353 Views)

With a referance to the cluster you can extract the Labels of the cluster in the same order that they are in in the type def.  Here's your vi modified slightly.

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 4
(2,348 Views)

Thanks for the options.

 

I tried both methods and both will accomplish what I need.  The OpenG method is a little cleaner and will probably be the version I go with for this project but the other option is something I'll keep in my toolbox for other conditions.

 

Thanks to both you guys for the input.

 

Doug

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 4 of 4
(2,329 Views)