LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cast datatype

hello,

i've got an cluster with a variant inside.
when i unbundle the cluster i need the datatype of the variant to convert the original data back.
the problem is that i dont know the datatype of the vatiant.
so i want to take another element into the cluster, where the datatype is called as a string.

is it possible to get the datatype?

has anyone another idea?

thanks

markus
0 Kudos
Message 1 of 3
(2,776 Views)
What you're up against is the classic problem of the fact that a wire can only have one datatype.
I didn't realize in your previous post that this is what you wanted. In this case, it may be preferable for you to flatten the data to string instead of using a variant and have the type descriptor (which you get when you flatten) as part of your cluster. Then, when you open the cluster, use unflatten from string. You should keep in mind that doesn't matter what you want to do with this, eventually you will have to unbundle the cluster seperately since you have different types coming out of the third cluster element. A good way to deal with this might be using a polymorphic subVI (which can only be created with the more expensive versions of LV).
BTW, it's better if you don't open a new thread for an existing subject, so that the discussion is kept in one location and is easier to follow.

___________________
Try to take over the world!
Message 2 of 3
(2,766 Views)
I agree with tst.

It's a better approach to use "flatten to string" & "unflatten from string". It keeps things tidy and easier to debug / improve in the future.

JLV
0 Kudos
Message 3 of 3
(2,758 Views)