In my applications I allow users to save their settings. I used to do this in a Ini file. So I wrote a Vi that could write any cluster and it worked ok. When I discovered that in the newer versions of LabVIEW you could Read/Write From/To xml, I changed inmediatly because it have some advantages form me but I am having some trouble.
Every time I want to save a cluster I have to use
Flatten To XML -> Escape XML -> Write XML
and to load
Load From XML -> Unescape XML -> Unflatten from XML.
I also do other important things each time I save or load settings. So it seems to be reasonable to put all this in just two subvi's. (One for loading, One for saving). The problem is that I want to use it with any cluster
What I want with can be summarized as following:
- SaveSettings.vi
--Inputs:
---Filename
---AnyCluster
---Error In
--Outputs
---Error Out
-LoadSettings.vi
Inputs:
---Filename
---AnyCluster
---Error In
Outputs
---DataFromXML
---Error Out
I have tried using variants or references and I was not able to make generic sub vi (sub vi that don't know what is in the cluster). I don't want to use a polymorphic vi because it will demand making one load/save pair per each type of settings.
Thanks,
Hernan