Example Code

Set subVI value from a top level VI using property nodes using 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

Description

1. Overview

This example VI opens all front panel objects in another VI. It compares the Class ID and Label of each one of these against the control reference and label specified at the front panel of the example VI, so that those matching change their value to another one.

 

2. Description

With Property nodes we can get or set properties and methods on local or remote application instances, VIs, and objects. This example VI receives a VI path to get all its front panel objects and, for the ones that fit the Class ID (an integer which uniquely identifies the class of a LabVIEW object) and label, to change their value to one specified in the "Value" control of this example's front panel.

Use this example to understand how to programmatically manipulate properties of controls and indicators using the VI server hierarchy classes and references, alongside property nodes.

 

3. Requirements

NI LabVIEW Base Development System 2012 (or compatible).

 

4. Steps to Implement or Execute Code

  1. Download and open the VI
  2. Modify the value of the "VI to edit" file path control to point towards a VI you want to programmatically modify.
  3. Write in "Label" the label of the object/control you want to modify from the called VI's front panel.
  4. Right click the "Control Ref" control and browse to Select VI Server Class > Generic > GObject > Control and select the class you want the code to look for and modify.
  5. Write in the "Value" string controls the value you want to assign to the class selected. Important note: You must change the data type for the control "Value" to fit the type of control reference you want to manipulate (for example: choosing a Boolean control reference will break the code and you'll have to change the "Value" string control to a Boolean string control).

 

5. Additional Information or References

 

Change subVI value with property nodes Screenshot.PNG

 

 **The code for this example has been edited to meet the new Community Example Style Guidelines.**

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