LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

type variable

Hi All

 

I am using the "Unflatten From String" VI. One of its terminals is called type. If I try to make a control from this terminal it produces a cluster with 0 elements.

 

I would like to create a user data type of my own (.ctl) where one of the controls in the containing cluster is type, so that I can specify the type I want to unflatten at runtime.

 

If I cut'n'paste the type control created from the terminal of the "Unflatten From String" VI into my .ctl, it looks like I am onto a winner. But when I then instantiate my .ctl and try to instantiate a constant to specify the type parameter, it does not like it.

 

Am I doing something silly even trying to treat type as a "parameter", or am I doing something wrong when I am creating my .ctl in the first place?!

 

Is type as specified in the "Unflatten From String" VI, something that cannot be wired and stored?!

 

Thnaks for any clarification you can give.

 

 

 

 

0 Kudos
Message 1 of 7
(2,672 Views)

Hi,

 

the type input needs to be a wire of the type you want to unflatten to. So if you want to unflatten to I32 you could use an I32 constant.

 

The type needs to be set before compile. To select a type at runtime (if I got you correctly that's what you want) you'll need a case structure with one case each for every possible type.

 

Best regards

Florian

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

It is what I want, but even if I use a case, is there a way of specifying a generic type to the tunnel, so that I do not need to replicate the VI (or set of typed VI's), for each selection case?

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

Not sure what you are trying to achieve in the end.

Putting the appropriate vis into the separate cases seems fine to me, but maybe I don't get your intend.

 

Could you elaborate, preferably with actual vis?

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

His concern, I think, is that the output of the case statement will be whatever "type" that case produces, i.e. real, int, boolean.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



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

I thought there were sub vis which would then use the unflattened type as input.

If so you could just place these sub vis into the cases they naturally belong in.

 

Any other solution I can think of (e.g. that would allow for the unflattened data to be wired out of the case structure) would just push back the problem.

Somewhere you'll have to know what type to use.

 

Regards

Florian

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

I think what you're after if Variant to flattened data, and Flattened data to variant, they give a type out that can be read and used.

 

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(2,594 Views)