04-12-2019 08:47 AM
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.
04-12-2019 11:22 AM
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:
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.
04-12-2019 01:39 PM - edited 04-12-2019 01:40 PM
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.
04-12-2019 01:41 PM
As I mentioned in my previous reply, the Data Type Parsing VIs do not preserve value when reading or writing data type information.
04-12-2019 01:42 PM
Hence, "Cluster Information", I definitely didn't read your reply properly. Thanks!
09-12-2019 02:04 AM
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
09-12-2019 05:51 AM
Not to worry, I came right, thanks.