10-03-2024 03:30 PM
In case anyone has strange issues with data coming out of the NI OPC UA toolkit user event subscriptions, the datatype is variant<variant<T>>, not variant<T>.
This seems to unpack the inner variant so it is variant<T>:
This isn't a question as much as a PSA to save future Googlers potentially several days of debugging.
10-03-2024 05:23 PM - edited 10-03-2024 05:40 PM
If the structure of the variant data is not too complicated, you can see it at a glance by looking at the variant control (provided that "Show Data" option is checked). Example for a Variant containing a Variant<Variant<I32>>:
As for the "Variant to Data" function, it unwraps as many levels of variant as needed to find underlying data with a compatible type.
You can make fun experiments like this:
The solution you found uses the same logic: it goes down in the variant until it finds... another variant, which is exactly one level lower:
Regards,
Raphaël.