From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Error to String in LabVIEW

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 example converts a single error to a string or an array of errors while only writing errors that have occurred

 

Description

I have always been dissatisfied with the 'Merge Errors.vi' that is packaged with LabVIEW because while creating a valid error cluster from an array of errors it doesn't show all the errors that occurred, just the first error it comes across in the array of error clusters you send it. Sometimes there are situations where you need to convert an error to a string or an array of errors to a string. For instance, recording a few different error lines to a file or sending errors over shared variable. So I made this little VI and it can convert a single error to a string (like the 'simple error handler.vi') or an array of errors while only writing errors that have occurred and writing nothing for status OK on all errors. You can wire an error, an array of errors, or both.

 

Requirements

LabVIEW Full Development System 2012 or compatible

 

Steps to Implement or Execute Code 

  1. Modifying the Status and Code on the Error In or Error Array Clusters
  2. Run the VI
  3. Notice that the errors are concatenated in the Errors Strings and the Error status turns ON if any error occurs 

 

  Additional Information or References

VI Block Diagram

 

 6664.PNG

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

---------------------------------
[will work for kudos]

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