I'd like to write a subvi to:
1. close an exiting text file using a file refnum as one of the subvi inputs
a. How to test for file open or ignore attempted close on an unopened file (refnum)
b. I can't find the "refnum" in the tool pallets.
Where is it so I can create the input and output parameters to the subvi?
2. open a new text file using:
a. path to existing directory (input to subvi)
b. file sequence number (input to subvi)
seqnum: 001 ... 999
A changed "seqnum" should be the trigger to cause the file close and new file creation.
An unchanged "seqnum" should cause the subvi to simple pass the input refnum to the output refnum.
(this would be done with a simple true/false case structure)
c. create a new file named: z:\MainData\SubData\data-001.csv
d. output the new refnum to be used in the main vi to write the data.
Also part of this involve multiple while loops:
1. data display loop (100 Hz) from the DAQ/control system (this data has already been saved)
2. command loop (waits for something to change on the GUI to generate a command to the DAQ/control system)
3. This new loop (1Hz) to collect data from a network instrument, display it on the GUI, and save the data.
Loops #1 & #2 live together just fine. Will loop#3 cause any interference with the other loops?
PS. I only create new VIs ever year or so. My Labview skills always atrophy so doing new things seems much harder then it should be.
1a) Just use the reference and handle the resulting error when you try to close an invalid reference. Probably just use Clear Error.
1b) Right-click on a file reference output on a file IO node and select Create->Control.
2) In the File IO->Advanced palette is the Create File With Incrementing Suffix.vi. You could just use it directly or make a copy and edit as needed.