LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the data type inside a User Event?

Hi,

 

While developing some malleable VIs to deal with user events, I suddenly hit a brick wall:

There is no way (that I know of) to get the data type inside a user event!

When I say get the data type, I don't want to get it as a variant, but as a strict type through data type propagation.

 

You can easily get the contained data type for most strictly-typed reference types (here for example with a contained boolean):

 

raphschru_3-1755102155124.png

 

...but trying a similar approach with user events seems impossible in the general case.

 

Here it works if the user event contains a scalar named exactly "Data":

raphschru_6-1755102981067.png

...but it fails if the element is named differently.

 

It is even harder if the user event contains a cluster:

raphschru_0-1755104165803.png

Since the event data node automatically unbundles top-level cluster elements, it seems impossible to have a code that works for all data types.

 

Any idea on this?

 

Regards,

Raphaël.

0 Kudos
Message 1 of 7
(259 Views)

Maybe this thread will give you some ideas.

0 Kudos
Message 2 of 7
(219 Views)

The only thing I can think of is to make an XNode instead of a malleable (but you probably don't want to do that).

0 Kudos
Message 3 of 7
(198 Views)

@mcduff wrote:

Maybe this thread will give you some ideas.


Very interesting thread about the early days of malleable VIs!

0 Kudos
Message 4 of 7
(154 Views)

@paul_a_cardinale wrote:

The only thing I can think of is to make an XNode instead of a malleable (but you probably don't want to do that).


Yeah, but not enough time at the moment to dive back into XNodes, plus the fact that they cannot be placed in malleable/inline VIs is still an annoying drawback for me.

 

My original idea was to have a malleable VI that takes a cluster of user events (refnums can be invalid, they are just used to get the data types), then creates the user event refnums appropriately and outputs the same cluster with the newly created references filled in.

 

I guess I'll give it a try when I have more time...

 

Regards,

Raphaël.

0 Kudos
Message 5 of 7
(147 Views)

@raphschru wrote:

@paul_a_cardinale wrote:

The only thing I can think of is to make an XNode instead of a malleable (but you probably don't want to do that).


Yeah, but not enough time at the moment to dive back into XNodes, plus the fact that they cannot be placed in malleable/inline VIs is still an annoying drawback for me.

 

My original idea was to have a malleable VI that takes a cluster of user events (refnums can be invalid, they are just used to get the data types), then creates the user event refnums appropriately and outputs the same cluster with the newly created references filled in.

 

I guess I'll give it a try when I have more time...

 

Regards,

Raphaël.


I think that the only thing that's going to work is to forget using a malleable, and put all of the functionality inside an XNode.

0 Kudos
Message 6 of 7
(114 Views)

Here's another possibility (but it's a bit kludgy):

In your project's buildspec, set up a pre-build action that finds all instances of your .vim and fixes them up.

0 Kudos
Message 7 of 7
(52 Views)