08-13-2025 11:47 AM - edited 08-13-2025 12:00 PM
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):
...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":
...but it fails if the element is named differently.
It is even harder if the user event contains a cluster:
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.
08-13-2025 02:13 PM
Maybe this thread will give you some ideas.
08-13-2025 03:23 PM
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).
08-14-2025 02:32 AM
08-14-2025 03:05 AM
@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.
08-14-2025 01:23 PM
@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.
08-16-2025 01:05 PM
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.
08-23-2025 08:57 PM
Just adding some design test VIs here for the associated idea I posted, since it is not possible to attach files in the Idea Exchange:
Regards,
Raphaël.
09-02-2025 04:52 PM
Here's an XNode that will do it.
09-03-2025 09:38 AM
@raphschru wrote:
@mcduff wrote:
Maybe this thread will give you some ideas.
Very interesting thread about the early days of malleable VIs!
It really was. Back then they were VI Macros, and it wasn't it's own thing, it was just an XNode that had some temple like function to it. You provided the VI to a XNode, and it would use the block diagram contents, inlineing it, and then having the type propagation that XNodes do already. I think it was after the beta that VIMs were no longer XNodes, but a more native features that didn't rely on that technology. The type specialized structure being a hidden drop, in only the Mac and Linux releases was a fun find. I had to download it, and extract all the pieces to get to the VIM so I could pull out the structure and mess around. I was able to make a few bullet points, and then have a demo for my NI Week presentation. I basically had "2 days" to get the structure, play around, and get something ready. It made for a fun time for sure. And I think I was presenting in the advance user track, at the same time Stephen (AQ) was right next door. Both of our presentations were packed. At NI Week that year I talked to Stephen saying how I thought it was crazy that Jeff just dropped this VIM, with this new undocumented structure, in the user.lib on the 2016 release. He had no idea. It sounded like Jeff went around several best practices for releasing code to get it in there. Good times.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord