02-05-2024 08:38 AM
Hi,
is it possible to create a VI which accepts only enums on its input (either typedef or a non-typedef), but makes wire broken if anything else (eg: u16) is connected? Something like as malleable VIs can do it.
Thanks.
Solved! Go to Solution.
02-05-2024 09:24 AM - edited 02-05-2024 09:32 AM
Hi 1984,
To my knowledge, only a malleable VI could do that, because a normal VI would allow integers to be connected to the enum input (adding a coercion dot).
Here is an example implementation of a malleable VI that only accepts enums:
- "Split Number" ensures the data type is an integer.
- "Format Into String" with constant format "%s" forbids plain integers, which leaves only enums as possible data type.
Both functions are removed by the compiler through a process called "Dead code elimination", so it won't affect execution memory or performance.
Regards,
Raphaël.
02-05-2024 09:41 AM
02-05-2024 10:01 AM
Actually this is exactly what I was looking for! Thanks!