06-17-2013 05:26 AM
I am using the invoke node ctrl.val.get.all to get the values of all controls within my software so the user can save the current state and load it back up at a future data. It returns an array of clusters. No problem so far. This cluster contains a string and a variant. Handling the string, again no problem. To get at the value of the controls though I need to process the variant so I can present the data nicely to a write spreadsheet.vi, the controls are of various data types (boolean and doubles mainly). I have been unable to find useful examples and documents. If someone could point me towards some links that would be great
Thanks in advance
06-17-2013 07:06 AM
Akiel,
I can't really help you out on a link, but maybe a different methodology. But this all depends on how you want to really USE these values. If you want the user to be able to use these values (saved control values), then maybe this won't be for you.
But if you simply use an invoke node to "set current as default" (after you enable edit mode) it should do what you need. But again, as far as specific values you want the user to be able to load dynamically, this might not be for you. If you use the invoke node "set current as default" with "reinitialize to default" then that gives you some user "play" within the application. But again, depends on how much "play" you want to give the user.
-chazzzmd
06-17-2013 07:52 AM
The values are in turn saved to a csv file so when the user relaunches the test program they can load them an use them as a starting point for their next test run instead of having to set a number of values manually I have a work round using flatten to xml but a have a feeling there is a better approach,
Thanks
06-17-2013 08:22 AM
You can use the function File I/O -> XML -> LabVIEW Schema -> Flatten to XML
to convert a variant to an XML string for saving to a file, then use the Unflatten from XML function to reverse.
06-17-2013 08:24 AM
I have used flatten to xml, then used the resultant xml to determine type and value. These are converted to string then saved to a spreadsheet
thanks
06-17-2013 08:35 AM
Akiel,
When you say "............relaunches the test program they can load them and use them as a starting point............" So is this an option you are giving the user upon 1st iteration or something or do you want your program to automatically use that CSV file? If no user generated event, my solution should work just fine, no CSV file needed. If yes, the user will provide an event (i.e. "loading") then maybe your CSV is the path you should be on. Personally when I have programs that I allow dynamic loading of input parameters I usually use .ini files.
Good luck.
06-17-2013 08:38 AM
The idea is they build a library of starting configurations then can select as appropriate. The loading part is a pre-existing section of code that works nicely from csv files. I can create the csv in the right format, its just finding a simple way of getting at the value(and type) from the variant