LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cluster Element Names Only

I have an application where I'm using the DB toolkit to populate some data into a database.  Everything is designed except for the columns.  I will need to index through them as the data is being sent out.  I've attached a picture of where I'm at so far...any idea how to go about extracting just the names?  I suppose I could make a 1D array and populate manually, but there has to be some way to manipulate that cluster wire to do this.  (You can see in the picture the cluster is manipulated to feed individual values from each name into the columns.)

(All data types stored in the cluster are integer values w/same representation)

Any ideas?


Message Edited by leachdor on 12-14-2007 10:46 AM
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 1 of 5
(4,238 Views)
Create a property node off the cluster and then get the All Objects[] which returns a reference to each item.  Then simply in the loop get its name from a property node.
0 Kudos
Message 2 of 5
(4,227 Views)
When I do that I get an error -
Source = GObject Refnum
Sink = 1D Array of String

Also, with this method I'm concerned about the order of items in the cluster.  Each iteration of the For loop will need to take an element name/value pair to properly populate the DB.  I noticed the following note in the description of that property node:

"This property does not use the cluster order to output the array of references to objects in the cluster. Instead, this property outputs the array of references to the cluster in a Z-order, where the first object is the last object inserted into the cluster and the first element in the array of references."

Maybe there is just a better way to populate all of those controls into the DB than how I'm trying to do so?
LV7.1, LV8.5, LV2014/15/16
0 Kudos
Message 3 of 5
(4,223 Views)

Sorry I looked at it too fast.  Rather than All Objects which will include decorations, thus the z order, use Controls[].

The order of those references will be the same as the cluster to array primative you are using.  From that you can then get an array of all the items or each items name 1 at a time.  See the attached VI.

0 Kudos
Message 4 of 5
(4,216 Views)

You're doing it wrong! The Insert Data VI inserts a single row, with each element in the cluster corresponding to a column in that row. What you actually need to is wire the entire cluster into the data input of the VI (you don't need to convert it explicitly to a variant and you definitely don't need the for loop) and there should be a columns or fields input where you can specify the names of the fields which correspond to the cluster elements.

There are some examples that come with the DB toolkit, and some of them are bound to show how you're supposed to use this.

As a side issue, even if you did need the for loop, you don't have to explicitly set N when you use auto-indexing - LabVIEW will run the for loop the smallest number of times of all its indexing inputs.


___________________
Try to take over the world!
0 Kudos
Message 5 of 5
(4,165 Views)