LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set Cluster Information

On palette Functions -> Programming -> Cluster, Class, & Variant -> Variant -> Data Type Parsing,

there is "Get Cluster Information.vi".  But I wanted the complement of that.  I went to the location of "Get Cluster Information.vi" (vi.lib\Utility\Data Type) and lo and behold there is "Set Cluster Information.vi".  But it doesn't work (which may be why it's not on the palette).  So I had to code my own.  Here it is in case anyone else would like it.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 1 of 7
(2,488 Views)

The 'Set' VIs in the Data Type Parsing API are not officially supported mainly because they solve an incredibly rare use case, which is creating or modifying arbitrary data types without preserving value. Here is an example usage of the Set Cluster Information VI:

1.png

 

In order for the VI to work correctly, the input has to be a variant containing a cluster. If you are wanting to define a new cluster type, then the elements of the source cluster don't matter, but it does have to be a cluster. In the code above, the VI creates a variant containing the cluster data type, and the Variant To Data will execute without error.

 

0 Kudos
Message 2 of 7
(2,461 Views)

Excellent timing, I am trying to use this VI, but it doesn't appear to work. I run this VI and the output "data" is still just the default data from the cluster.

I am using LV 2015 SP1.setclusterinformation.PNG

 

0 Kudos
Message 3 of 7
(2,445 Views)

As I mentioned in my previous reply, the Data Type Parsing VIs do not preserve value when reading or writing data type information.

0 Kudos
Message 4 of 7
(2,441 Views)

Hence, "Cluster Information", I definitely didn't read your reply properly. Thanks!

0 Kudos
Message 5 of 7
(2,438 Views)

Hi Paul

Thanks, I need Set Cluster Information_, but I only have LV2015SP1.

I would appreciate it if you could maybe post a screenshot of your code so I can recode it in LV2015. (I cannot open your vi as it is in LV2017)

Thanks

 

0 Kudos
Message 6 of 7
(2,257 Views)

Not to worry, I came right, thanks.

0 Kudos
Message 7 of 7
(2,239 Views)