LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"save report to file"

I wish to use the "save report to file" function to save to a network, but if the network is not available (error code 6) then I wish to save the file locally on my C: drive. How can I capture this 'error code 6' before it happens and then divert the file to the local drive instead without any pop-up's?

 

 

0 Kudos
Message 1 of 5
(3,156 Views)

Hi Steve,

 

"pop-up's" let us assume you're not doing error-checking Smiley Wink

 

How to avoid such errors:

Check error outputs of file functions!

Try to open a file (or: try to get info for the network drive) first. When no error is delivered from the file function then you can write to the network. When an error is indicated you have to change the path for saving. 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,152 Views)

Further to Gerd's comments...

 

Since I didn't see the code, I can only speculate based on the described behavior.

Are you wiring all the error clusters within the block diagram?  For instance, you can use the information from error status / number / message in order to make decisions within a state machine.

 

You should also use an Error Handler in order to avoid the popups.  An alternative would be to use an Error Out Indicator.

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.

Message 3 of 5
(3,140 Views)

 

Hi Steve,

 

You can use "Check if file or Folder exists.vi" to know the existence of the link..This is available under Advanced Functions.....Based on the result, you can change your path and give to "Save Report to file" VI

 

 

 

Anil Punnam
CLD
LV 2012, TestStand 4.2..........
0 Kudos
Message 4 of 5
(3,116 Views)

Hi Steve,

 

I have been looking into your issues for you. Firstly, I must advise that either of the recommendations on this page are perfectly valid methods for achieving your desired results. The Check if File or Folder Exists VI could be used to determine whether a specific path on the network exists which will output a Boolean which indicates the outcome. This Boolean can then be used to select which path to save the file to using a case structure. A very simple example of this has been attached below. This approach would ensure that the error would never occur therefore eradicating your error pop-up issue.

 

For this particular instance I would recommend using the above method, though for more complex applications it may be worth adopting a more sophisticated manual error handling strategy rather than automatic error handling that is used by default.  For more information on this, see the following document.

 

Handling Errors

https://www.ni.com/docs/en-US/bundle/labview/page/handling-errors.html

 

I hope this helps but let me know if you require further assistance.

 

Christian Hartshorne

Applications Engineer

National Instruments

0 Kudos
Message 5 of 5
(3,082 Views)