LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

polymorphic to any cluster

Solved!
Go to solution

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 1 of 5
(3,411 Views)

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.

Message 2 of 5
(3,395 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 5
(3,373 Views)
Solution
Accepted by topic author Yamaeda

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.

Rolf Kalbermatter
My Blog
Message 4 of 5
(3,366 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 5
(3,360 Views)