You can create several single global VIs, each with one front panel object, or if you want to group similar variables together, you can create one global VI with multiple front panel objects.
Complete the following steps to create a global VI with multiple front panel objects.
- Add a global variable to the block diagram.
- Use the Operating tool or Positioning tool to double-click the global variable node to display the front panel window of the global VI.
- Add controls and indicators to the front panel window the same way you do in a standard front panel window.
|Note LabVIEW uses owned labels to identify global variables, so label the front panel controls and indicators with descriptive owned labels.|
- Save and close the global VI.
- Return to the block diagram of the original VI and right-click the global variable node and select a front panel object from the Select Item shortcut menu. The shortcut menu lists all the front panel objects that have owned labels. You also can use the Operating tool or Labeling tool to click the global variable node and select the front panel object from the shortcut menu.
Complete the following steps to use a global variable in other VIs.
- Click the Select a VI icon or text on the Functions palette, navigate to the directory where you saved the global VI, and double-click the VI.
- Add the global variable to the block diagram. By default, the global variable is associated with the first front panel object with an owned label you added to the global VI.
- Right-click the global variable node you added to the block diagram and select a front panel object from the Select Item shortcut menu to associate the global variable with the data from another front panel object.
|Note Use a global variable only when you cannot route a wire through multiple VIs to share data. For example, if a file path is changed in one VI and another VI must open that path, there might not be a logical way to wire the path through numerous calling VIs. Using a global variable to hold the path data might be the best choice.|