07-19-2004 05:00 PM
07-19-2004 08:02 PM
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-20-2004 11:28 AM
07-20-2004 06:23 PM
It's not possible to CREATE a VI at runtime, but I don't understand why you need to.
If the "customized" tests follow the same logic flow, just with different parameters, then it's very easy to save those parameters into "setup" files (call them what you will). Then just list all datalog files of type .XYZ, and let the user choose one. When a file is chosen, read it, and set your parameters accordingly.
I would definitely do it using DATALOG files, not text files. They're easier, more bulletproof, and smaller (if your setup data is large).
Read up on them, if you can.
Try this:
Create a cluster on a new front panel and put several things in it. Booleans, strings, I32s, DBLs, I don't care what.
Create a PATH control on the front panel, and set it to something like ERASE THIS FILE.DAT (some new name)
Place a NEW FILE function, a WRITE FILE function, and a CLOSE FILE function on the diagram.
Wire the PATH to the NEW FILE function (with TRUE as the OVERWRITE input).
Wire the refnum and error from NEW FILE into the WRITE FILE.
Wire the cluster to the DATA of the WRITE FILE function.
Wire the refnum and error from WRITE FILE into the CLOSE FILE.
Run it.
You have written all that data into a file.
Try this (separate VI).
Copy the same cluster control from before onto this new front panel. Make two of them: one a control, one an indicator.
Place a FILE DIALOG function, an OPEN FILE function, a READ FILE function, and a CLOSE FILE function.
Wire the cluster into the DATALOG TYPE input of the FILE DIALOG, and the DATALOG TYPE of the OPEN FILE function.
Wire the path from the dialog to the OPEN FILE.
Wire the refnum and error lines from OPEN FILE to READ FILE, and from READ FILE to CLOSE FILE.
Wire the DATA output from READ FILE to your cluster indicator.
Run it and choose the file you wrote earlier - there's your data.
Note that you don't see any .TXT files, or other files in your dialog - by using DATALOG files, you exclude those from even appearing - the user cannot choose an invalid file.
You can write as many records as you want to a single file, although these setup files usually only have one.
CAVEAT: If you add or remove some item from the cluster, you cannot read older files, created with the previous version. I get around this by using spare fields in the cluster.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-21-2004 08:07 PM
07-21-2004 08:12 PM
07-21-2004 09:03 PM
I don't know what you're after - please be specific.
Why do you need to know if ch
anges were made in a VI?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
07-22-2004 10:32 AM
07-22-2004 10:59 AM
07-22-2004 11:22 AM
Blog for (mostly LabVIEW) programmers: Tips And Tricks