Showing results for 
Search instead for 
Did you mean: 

Using Error Codes to run a certain segment of the VI

Go to solution


I was wondering if it was possible to use an Error code to run a specific portion of a VI. Simply put, if there is a certain error X will happen. 

0 Kudos
Message 1 of 4
Accepted by chris.james117

Use a Case Structure.  I don't remember which version started this (2018? lack the time to look it up), but you can wire the error cluster to the case selector and put the error code in the case identifier.  If you are using an older version, you can use Unbundle By Name to get the error code and use that for the case selector.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4

I just figured it out about 30 seconds before you replied. But this is the correct answer. Thank you very much!

0 Kudos
Message 3 of 4

I just want to add, "Congrats!  You've entered the world of error handling."  This is a very important step if you want to create LabVIEW applications of any complexity, and absolutely critical if you are going to build an executable.


I employ two kinds of error handling.  I handle any "expected"- that is, common errors that would occur with the action, like an "file not found" error if I am trying to open one - immediately.  e.g., Popup "File not found.  Please navigate to the folder that contains the xyz file." and then show a file dialog box.  The second kind of error handling is what I call the "general" error handler.  At the end of the loop, I will clean up any errors that have made it all the way to the end.

(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 4 of 4