annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Cluster Element Names

I have a few clusters that contain data that I am putting in a database using a Python script. I want to label things as they go into the database based off of what the element name in the cluster is and I want to do this dynamically so that if I change the name of the elements in the cluster it will change what I am sending to the python script and go in with the new name. I can not find a way to dynamically create an array or any data structure that holds the name of the elements in a cluster. In short I want to grab a cluster and output some data structure with the list of element names from the cluster. Any information on this would be great!

 

Thanks!

0 Kudos
Messaggio 1 di 10
3.797Visualizzazioni

Use the Get Cluster Information VI to get an array of cluster elements and then Get Type Information to get the name of each array element.

Messaggio 2 di 10
3.781Visualizzazioni

You can flatten a cluster to JSON or XML and parse the names from there.

Matt J | National Instruments | CLA
0 Kudos
Messaggio 3 di 10
3.778Visualizzazioni

The OpenG toolkit has "Get cluster element names":

 

BertMcMahan_0-1650040078965.png

 

Edit: Dang, lots of posts. Use Kyle's suggestion, it doesn't require an external toolkit. I didn't know that one was there.

 

Messaggio 4 di 10
3.771Visualizzazioni

@BertMcMahan wrote:

The OpenG toolkit has "Get cluster element names":

 

BertMcMahan_0-1650040078965.png

 

Edit: Dang, lots of posts. Use Kyle's suggestion, it doesn't require an external toolkit. I didn't know that one was there.

 


Nope, Kyle's method will get a list of datatype names not element names.

 

Try showing us the BD of the OpenG vi


"Should be" isn't "Is" -Jay
0 Kudos
Messaggio 5 di 10
3.742Visualizzazioni

@JÞB wrote:

@BertMcMahan wrote:

The OpenG toolkit has "Get cluster element names":

 

 

Edit: Dang, lots of posts. Use Kyle's suggestion, it doesn't require an external toolkit. I didn't know that one was there.

 


Nope, Kyle's method will get a list of datatype names not element names.

 

Try showing us the BD of the OpenG vi


Kyle's method returns the same thing OpenG does:

 

Example_VI.png

 

The OpenG method uses a bunch of other OpenG VI's internally, so posting just that one's block diagram isn't very useful. At its core though it uses Variant to Flattened String and parses the result.

Messaggio 6 di 10
3.727Visualizzazioni

Thanks Bert,

 

I'll have to submit feedback on the help for Get Type Information.vi.  

 

The help clearly states Name is the Name of the data type not the Lable of the Variant.


"Should be" isn't "Is" -Jay
0 Kudos
Messaggio 7 di 10
3.721Visualizzazioni

Yeah, the data type (U8, String, etc) is returned as an enum in the "type" output and the label of the data is given in the "name" output. In the Help file it does specifically say "name returns the name of the data type stored in variant". Definitely not the right language.

0 Kudos
Messaggio 8 di 10
3.715Visualizzazioni

Since you are passing the data to Python I would recommend flattening your clusters to JSON.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Messaggio 9 di 10
3.666Visualizzazioni

Flattening to JSON seems to be the clear answer here.

Cluster to JSON.png

 

Note that the label of the cluster itself is not included in the JSON string, though.

_______________________________________________________________
"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Messaggio 10 di 10
3.620Visualizzazioni