Example Code

Clearing a Specific Error From The Error Cluster

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI shows how to define a specific error in your code and when this error appears while running the code, you can clear it from the error cluster.

 

 

Description

While the best error practice is to handle all errors, there may be times (such as user defined errors) where the user may want to simply clear an error. LabVIEW has a built in function called "Clear Errors" that will clear any error in an error cluster. In order to selectively clear an error with this VI, you need to check the error cluster first for your specific error, and then use the "Clear Errors" function.

 

The attached example creates a new SubVI that allows a user to input a specific error (or array of errors) and then clear the error cluster when the appropriate error code is seen in the error cluster. The SubVI is implemented as a polymorphic VI and is a good example of dynamically adapting to terminal inputs as well. The input can either be a single numeric error code or an array of numeric error codes to check and clear. This example performs the following:

 

  1. The VI compares the error(s) that occurred with the error(s) you wish to clear.
  2. If the errors are found we clear the error cluster.

 

 

Requirements

LabVIEW 2012 (or compatible)

 

 

Steps to Implement or Execute Code

  1. Download the attached Zipped folder "Clear Specific Errors Polymorphic_LV2012_NI Verified"
  2. Open the project and launch the Clear Specific Error (main) VI
  3. Run the VI
  4. Choose from the tab to clear a single error or an array of errors

 

 

Additional Information or References

Block Diagram

BD.PNG

 

Front Panel

FP.PNG

 

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Todd S.
NI Employee (retired)
on

Great stuff Captain!  Please add "LabVIEW" to the tags.

Todd S.
LabVIEW Community Manager
National Instruments
Captain_Kirby
NI Employee (retired)
on

Thanks! Added the tag (and a few others.) Also fixed my screenshot (I hate when I can see the selection boxes on case structures in a screenshot.)

Asa Kirby
CompactRIO Product Marketing Manager
________________
Sail Fast!
crossrulz
Knight of NI Knight of NI
Knight of NI
on

Be sure to check out the OpenG version of this VI.  I think you need LV2009 to run those.  But we tweaked to get a little better performance than these will for the searching.


GCentral
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