LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Carrying data over

What is the best way to carry data over from one VI execution to the next?  For example, I want to save the date of the last time a machine was calibrated and I want a VI every time it is executed to lookup to this date so the user knows when the next calibration is due.  Is the easiest thing to do to save the date in a text file and have LabView read the text file? 
 
This is a fairly simple instance, but are there more sophisticated techniques?
 
Thanks.
0 Kudos
Message 1 of 8
(2,996 Views)
Make current Value Default by Property or Invoke Node I think.
Or INI File.
0 Kudos
Message 2 of 8
(2,989 Views)

  Is the easiest thing to do to save the date in a text file and have LabView read the text file? 
 

 
That is pretty much the only good way.  Look at the config file VI's under the file I/O pallette.  Also, I believe OpenG has a toolset that would help with this as well.
 
The save values as default would only work on a non-running VI.  And it would force you to have to save the VI.  It is not a good idea to constantly resave a VI if the only real changes were data.  Saving data should be part of the program's architecture rather than relying on what is essentially a hack to do it within the labview development environment, and wouldn't work if you wanted to make this a standalone executable.


Message Edited by Ravens Fan on 01-09-2008 03:18 PM
0 Kudos
Message 3 of 8
(2,974 Views)
I would have to agree that for something like this an INI file is probably the best solution. The file palette has a sub-palette for configuration file VIs and there are probably examples in the example finder.

If you want to save more complex data structures, you can try the OpenG variant configuration VIs.

___________________
Try to take over the world!
0 Kudos
Message 4 of 8
(2,970 Views)


Ravens Fan wrote:
 
The save values as default would only work on a non-running VI.  And it would force you to have to save the VI.  It is not a good idea to constantly resave a VI if the only real changes we re data....

Yes, of couse. Smiley Wink

I use XML-Files to save e.g. complex program settings. But if you have only one element to save, than an TXT-File with one value is the easiest way to do it.

0 Kudos
Message 5 of 8
(2,952 Views)
Here the solution
Download All
0 Kudos
Message 6 of 8
(2,950 Views)
I played around with the "Write Config File" and "Read Config File" functions and I think these may work.  (I think these are the INI files referred to earlier, but I am not sure.  If I am wrong please set me straight.)  Some of the information I need to save is pretty simple (a specific date, polynomial coefficients, etc.), so I think I will use these INI files for that.  I also need to keep a record of test numbers and the user needs to know whether a test number has already been used.  Right now I use a text file for that, and I think I will probably stick with that method for now.
 
I am basically self taught on LabView so I don't know a lot of the finer details.  What is OpenG?  Is this something that comes with LabView?
 
I don't think I've mentioned that I am using LabView 8.2.1 and 8.5.
 
Thanks for everyone's help.
 
0 Kudos
Message 7 of 8
(2,928 Views)
Config files are indeed INI files. They are simply text files with Key-Value pairs and are easy to work with.
 
OpenG is a group which releases open source tools for LabVIEW. Their variant configuration package can save and load arbitrary clusters to INI files without requiring writing code for each element. I provided a link in my last post.
 
If your test number is simply an incrementing number, I assume you can save it in the INI file as well, but that depends on the exact details.
 
If you want to learn more about LabVIEW, you can try looking at some of these tutorials.

___________________
Try to take over the world!
0 Kudos
Message 8 of 8
(2,925 Views)