Set Control Values by Index Function

LabVIEW 2018 Help


Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)


LabVIEW 2015 Help
LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help

Owning Palette: Application Control VIs and Functions

Requires: Base Development System

Sets values to the controls for the VI you reference. This function offers better performance than VI Server objects that write to the terminal of a front panel control, such as using the Value property in the Control class. However, this function requires more advanced application design than other methods for setting control values.

Details  

VI Refnum specifies a reference to the VI for which you want to set multiple control values. You can wire a strict or non-strict reference to this input. The default is a reference to the current VI.
control indexes specifies the indexes of the front panel controls for which you want to set values. Use the Control Index property in the Control class to retrieve control indexes.
data values specifies the values to write to the controls. The default is a variant, but you also can specify the data type for the values you want to write to the control. To specify a single control, wire a scalar index to control indexes and wire a single value to data values.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
error out contains error information. This output provides standard error out functionality.

Set Control Values by Index Details

The Set Control Values by Index function requires that the VI for which you want to set control values is running or in run mode. Furthermore, the controls for which you want to set values must have terminals on the block diagram.

Note  Because controls nested within clusters or arrays do not have terminals on the block diagram, you cannot set values for those controls.

This function iterates over the length of the shorter of the two arrays you wire to control indexes and data values. The function attempts to set all values and does not stop on the first error. If an error occurs for multiple indices or values, LabVIEW reports only the first error.

Application Design Considerations

Use the following recommendations to obtain the best performance when you set control values with this function:

  • Retrieve the index of a control only once during an initialization section of an application.
  • To set control values for the current VI, leave VI Refnum unwired.
  • Set multiple values in a single call to minimize overhead.
  • To set values for a group of controls that have the same data type, wire an array of that data type to data values. For example, wire an array of 64-bit double-precision floating point numbers to data values to update a large group of numeric controls whose representation is 64-bit double-precision, floating point.

WAS THIS ARTICLE HELPFUL?

Not Helpful