Example Code

Ring Help - How to Get a String Value from a User/Active Selection Programmatically 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

Demonstrates how to obtain the string value of a Ring even when its numeric values are not sequential

 

Description

If you create a ring and want to get the string value from a user/active selection, that can be very easy if the ring's numeric values are sequential. If you uncheck "sequential values" (see screen shot) when editing ring items and enter non-sequential values, then getting the ring values in such a way that is scalable for multi-vi development is a bit trickier. I am offering this solution as a good way to get those string values from a non-sequential ring that will be easy to implement and scale later as ring values change.

 

select+sequential+values.jpg

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Choose an item from the Ring structure
  2. Run the VI
  3. The program will output value and string of the chosen ring item

 

Additional Information or References

The process to adapt the attached VI to your program is straight-forward. Replace the ring, "Ring," in this example with your application's ring. Then, right-click the ring you replaced it with an select Create»Reference. Replace the reference on the block diagram with the new reference and wire it into the property node.

get+ring+strings.jpg

 

 

 

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

 

Dan Richards
Certified LabVIEW Developer

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