LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

getclusterinfo not working as I expect

Hi, I'm trying to use \vi.lib\Utility\VariantDataType\GetClusterInfo.vi and it doesn't quite seem to give me what I think it should. It seems to somehow lose the data values.

 

PS, I tested this in 8.5 and 8.6 

Message Edited by InfiniteNothing on 02-16-2010 02:42 PM
CLED (2016)
0 Kudos
Message 1 of 10
(3,146 Views)

You are correct. GetClusterInfo strips out the values. But there is a trick you can use to get the values out of a cluster to use in conjunction with this VI. Use Variant to Data to cast your cluster into an array of variants. Then each variant element of the array will correspond to a cluster element.

 

Picture 4.png

Picture 5.png

Message Edited by Jarrod S. on 02-16-2010 06:01 PM
Jarrod S.
National Instruments
Message 2 of 10
(3,125 Views)
Neat. I think that will work for me.
CLED (2016)
0 Kudos
Message 3 of 10
(3,120 Views)
SetCluster is giving me the same problem. Any work around this time? 🙂
CLED (2016)
0 Kudos
Message 4 of 10
(3,113 Views)

I know this is possible, but we're about at the limits of my direct knowledge on the subject.

 

However, this problem has been solved before by the wonderful folks behind OpenG. There's a package you can download and use (if the open source license fits your needs) that can handle all this. Specifically they have VIs such as the following that sound promising:

 

Cluster to Array of VData

Array of VData to VCluster

Set Cluster Element by Name

Jarrod S.
National Instruments
0 Kudos
Message 5 of 10
(3,102 Views)
I realize it's not your packages but is there a way to see how it's done without the install?
CLED (2016)
0 Kudos
Message 6 of 10
(3,091 Views)

The OpenG package hack directly into the variant stream of the data.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 7 of 10
(3,082 Views)

Is there a reason why the "built in" tool strips out the data? 

 

Can anyone comment on the reliability of the OpenG method? I'm nervous relying on it. I don't want it to test it with clusters of dbls only to have it fail on enums or something.

 

CLED (2016)
0 Kudos
Message 8 of 10
(3,073 Views)

The OpenG tools have been around for a long time, and I believe they have a pretty proven track record with noting and fixing bugs. Also, I'm pretty sure this tool has been used as the backbone for other OpenG packages, such as the variant INI configuration tools. This speaks to the level of testing it has received.

 

Their approach acts directly on the type descriptor information and flattened string components, rather than staying directly with variants. I would not recommend recreating this functionality. You'd likely create many more bugs than might exist in this tool! I'm of course not commenting on your skills as a developer, just on the nature of the trade 🙂

 

In regards to the built-in variant tools from NI, the general problem is that these were probably created to solve some problem that NI faced, and then the engineers realized they might be generally useful. But this means they might not have been designed to solve a more general user problem. Just a guess...

Message Edited by Jarrod S. on 02-17-2010 09:18 AM
Jarrod S.
National Instruments
Message 9 of 10
(3,070 Views)
I found a solution that worked for me. I thought it might be helpful for anyone coming across this thread trying to do something similar
CLED (2016)
Message 10 of 10
(3,052 Views)