LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error with open/create/replace vi

I want to modify the �Open/Create/Replace File.vi� so that when it �sees� an existing file, I can replace it or go back and put in a different name. Currently the choices are replace and cancel. When cancel is selected, a pop up window appears asking me to continue or stop. At that point my data is gone. Is there a way I can rewire that loop to go back to a previous loop?

I also have a problem when an illeagal character is used in the file name. I get �Error 6 occurred at Open File.�. I then have the choice to continue or stop. Either choice my data is gone. Suggestions?

I am running LV 5.0 and Win 95. (I know it's old)

If you could give me a visual of the diagram, I would greatly appreciate it.


Thanks.

Greg.
0 Kudos
Message 1 of 6
(3,236 Views)
You could put your Open/Create/Replace vi inside a loop, and exit only if the refnum returned is valid. If it is Not A Refnum, then prompt user to re-enter a new filename and repeat the loop with new filename. This will take care of existing files and illegal characters in file names.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 6
(3,236 Views)
My "main" program prompts the user for a file name after it aquires data. That is a sub vi and that file path is sent to another sub vi (Write To Spreadsheet File.VI). That vi uses sub vi "Open/Create/Replace vi". I would like to go back to my vi that prompts for a file name. Can I go back to that point if I put the Open/Create/Replace.vi in a loop?
0 Kudos
Message 3 of 6
(3,236 Views)
Why do you want to go back to that point? You can just re-prompt in your sub-vi. Or you can place the Open/Create/Replace.vi where you do the original prompt in your main vi, check for errors and re-prompt there. Once the file is open, you can pass a reference to sub-vi's that do the writing.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 6
(3,236 Views)
As you have probably already guessed...I am pretty much an infant when it comes to Labview. My open/c/r vi is in a case structure and that is in a stacked sequence structure in one frame and the other frame has the vi for the file name prompt. That is all contained in a case structure which allows me to create a new file or append to the last file ran. I would like to get back to the stacked sequence. I tried doing the "not a refnum" at the o/c/r and it just went right through.
Thanks in advance for all your help.
Download All
0 Kudos
Message 5 of 6
(3,236 Views)
You do not have to Open/c/r file in the same frame as writing the file. Move this step to the frame that prompts for the filename. Check for filename errors here. Pass the checked OK filename to the Open/c/r function. Pass the file reference output from Open/c/r to the next frame and so on until it gets to the frame that writes to the file.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 6
(3,236 Views)