02-11-2013 05:23 PM
So, Unflatten to XML can take any cluster and return data in the same form. How do you recreate that behaviour, i dont think there's a polymorhic vi with all possible cluster configurations. 🙂
/Y
Solved! Go to Solution.
02-11-2013 06:22 PM
The Read/Write Anything VIs from Moore Good Ideas do something similar and the code is open enough that you can see one way to do it. A few key VIs are locked but can be replaced with VIs that are part of the Variant library that ships with LabVIEW (which are also password protected but at least come from NI). Note that the output is a variant so you need to put a Variant to Data after it, but you do get comparable functionality.
02-12-2013 01:34 AM - edited 02-12-2013 01:38 AM
Yes, looking inside Insert from database toolkit i got some good ideas on how to handle any cluster, but i'm currently using Variant to data on the resulting Variant. The beauty of flatten to XML is that the input/outputs handle this automatically, that's what i want to recreate. 🙂
Heh, it's basically the same idea i'm trying to implent - Any cluster to ini-file. It's working rather good already, but i'd like the inputs to adapt for it to be really beautiful. 🙂
/Y
02-12-2013 01:40 AM - edited 02-12-2013 01:40 AM
You can't create a true adaptive VI yourself. That is something only build in LabVIEW nodes can have, as underneath there is C code determining the datatype attached to the terminal and operating on it in a highly recursive algorithme. There is no mechanisme currently in LabVIEW that allows writing the same functionality in a VI. The best you have are either polymorphic VIs which require one VI implementation per supported datatype, or variants which are runtime typed elements.
Another idea to look at for dealing with variants would be the Variant Data library (and the Variant Ini Data library as a use case) from OpenG. No password protected VIs there aside from a few that come with stock LabVIEW.
02-12-2013 01:45 AM
Ok, thanks Rolf, not quite the answer i was hoping for. 🙂 I'll stick with external variant to data, the functionality is still great!
/Y