LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Force subVI to process even if error

Solved!
Go to solution

Hi I have a testing project where I enable a multiplexer prior to performing a test, and then disable it afterward. But the subVI that performs the enable/disable will not process and do the Disable if test fails for some reason, and there is an error coming into its error cluster, as per the standard error behavior. So if the test errors, the multiplexer is not disabled as I require.

 

Is there an elegant way to ensure cleanup code always runs regardless of errors, similar to the Finally statement in a Visual Basic Try Catch Finally block?

 

Thanks for any advice.

0 Kudos
Message 1 of 3
(2,456 Views)
Solution
Accepted by topic author TripleAntigen

I don't know anything about Visual Basic, but it is quite easy to do what you want in LabVIEW.

 

Wire the error to the selection terminal of a case structure.  The case structure will change to a special Error/No Error case structure. In the No error case just wire the error straight through and on to the subVI.  In the Error case wire a No Error constant to the output tunnel going to the subVI.  If you need to keep track of the error or handle it in some way, handle it in the Error case or wire it to a separate error out tunnel and on to the error handler VI.

 

Lynn

Message 2 of 3
(2,451 Views)

Brilliant, thanks, worked like a charm!

0 Kudos
Message 3 of 3
(2,444 Views)