LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Edit value of cluster's element in variant by name

Hello All,

I have many type definitions of cluster ed i manage them by making variant.

I need a clever way to edit the element of the cluster identified by the name without cast the variant to the type def. (it is simpler to see what happens in the flat sequence structure in the image below).

I thought to pass by some proprieties of the reference but it seems impossible to convert the reference of a variant into the reference of the contained cluster and is not possible too the re-composition of the variant of cluster after its decomposition in array of variant.

Is the only way to pass throw the "OpenG LabVIEW Data" package?

 

Many thanks

 

ico82_1-1581330821199.png

0 Kudos
Message 1 of 3
(2,604 Views)

You can probably do it the other way, instead of converting it to and from Variants, you do it all as variants.

You can Convert a Cluster to an Array of Variants (with Variant to data) and simply Replace Array Element, then convert back to the original cluster with Variant to data on the variant array (you might need a To Variant also, and if that doesn't work you'll have to go through Flatten to string ...)

I'll have to test it when i get home. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 3
(2,580 Views)

@Yamaeda  ha scritto:

You can Convert a Cluster to an Array of Variants (with Variant to data) and simply Replace Array Element, then convert back to the original cluster with Variant to data on the variant array


I had tried this way (now I will check again) I cannot found a way to rebuild the variant back exactly like the original, the new variant is not the variant of my starting cluster

0 Kudos
Message 3 of 3
(2,572 Views)