LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Error 7 in SaveReportToFile.vi

Hi All,

 

This is probably another case of my being a total Newb, but I am getting an Error 7 whenever the SaveReportToFile.vi encounters a file path that points to a nonexistent folder (see below for explanation of how I am building the file path).  (I do understand what the Error 7 is, and that it is appropriate under the circumstances, but wonder how to handle it).

This program is supposed to read data out of a scope (which it does), and then capture the front panel into an html file.  It all works, provided that the folder designated in the concatenated string is already there.  I'd like it to just create the folder if it doesn't; the whole idea being that the multiple reusable parts in the file path are there by virtue of hard-wired strings and selections from a combo box (to get into the right folder and subfolder), plus the serial number of the part being tested.  For the curious, the reason some folder combinations are not already in existence is that a) I am allowing the combo box to accept user input, and b) there will be another layer to this when I'm done, which adds a subfolder using "today's date" formatted as DDMMMYY.  So once a day the new folder will need to get created...

 

I'm almost there, but does anyone know of a straightforward way to handle this error?  I was thinking of wiring error out to a case structure with the case being "Error 7" and then creating the folder, but that seems like it might not work (should the case be called just "7"?) or it might create the folder after the opportunity to save the file has already passed.

 

thanks for all your help!

 

Danielle

 

 ERROR 7.JPG

0 Kudos
Message 1 of 3
(2,605 Views)

Forgot to mention; I am using LV 8.6...

 

Danielle

0 Kudos
Message 2 of 3
(2,603 Views)
You can use vi.lib\utility\libraryn.llb\Create Directory Recursive.vi to create the folder that contains the file you want to generate, before calling the Save Report VI.  If the folder already exists, the VI is just a no-op.  If it doesn't exist, it creates it.
Message 3 of 3
(2,597 Views)