From 12:00 AM CDT Sunday, October 17 - 11:30 AM CDT Sunday, October 17, will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Building Polymorphic VIs

LabVIEW 2018 Help

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

DOWNLOAD (Windows Only)

LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help
LabVIEW 2020 Help

Polymorphic VIs adapt to different data types. A polymorphic VI is a collection of VIs with the same connector pane patterns. Each VI in the collection is an instance of the polymorphic VI, and each instance has at least one input or output terminal that accepts a different data type than in the other instances.

For example, the Read Key VI is polymorphic. Its default value terminal accepts Boolean; double-precision, floating-point numeric; 32-bit signed integer numeric; path; string; or 32-bit unsigned integer numeric data.

Build polymorphic VIs when you perform the same operation on different data types and the operation must be implemented differently across data types. If the operation can be implemented in similar ways for different data types without significant customization for a specific data type, build malleable VIs instead.

Complete the following steps to build a polymorphic VI.

  1. Create two or more VIs with the same connector pane pattern. Make sure the connector panes have corresponding input and output terminals—if a terminal on the connector pane of one VI is an input, the corresponding terminal of the connector pane of the other VI(s) also must be an input or it must be unused. The same applies for output terminals. The VIs do not have to have similar data types or similar subVIs and functions.
  2. Select File»New to display the New dialog box.
  3. From the Create New list, select Polymorphic VI.
  4. Click the OK button to display the Polymorphic VI window.
  5. Click the Add button to display a file dialog box.
  6. Select one of the VIs you created to include as an instance in the polymorphic VI, and click the OK button. The VI appears at the top of the Instance VIs list. The instance at the top of the list is the default instance of the polymorphic VI and determines the default connector pane for the polymorphic VI.
  7. Repeat steps 5 and 6 to include other VIs. Any VIs that do not conform to the default connector pane pattern appear with a broken icon . You still can save the polymorphic VI. To remove an instance from the polymorphic VI, select the instance and click the Remove button.
  8. (Optional) To change the order of the instances, select an instance in the list and click the Move Up arrow button or the Move Down arrow button. You also can select an instance in the list and drag it to a new position in the list.
Note  Double-clicking a VI in the Instance VIs list opens the VI.
  1. (Optional) To specify how the polymorphic VI appears on the block diagram, configure the Block Diagram Appearance options.
  2. Click the Edit Icon button to create an icon for the polymorphic VI.
  3. Create a description for the polymorphic VI by selecting File»VI Properties and selecting Documentation from the Category pull-down menu. The polymorphic VI description is not associated with descriptions of the instance VIs that compose the polymorphic VI. If you select Draw Instance VI Icon in the Polymorphic VI window, create descriptions for each instance VI because LabVIEW displays the connector pane and description of the instance VI in the Context Help window when you move the cursor over the polymorphic VI. The Context Help window also displays a description of each instance as you move the cursor through the shortcut menus of the polymorphic VI or its selector.
  4. Select File»Save to save the VI.
  5. Select File»Close to close the Polymorphic VI window.

You also can add or remove an instance in an existing polymorphic VI, edit the shortcut menus of a polymorphic VI and its selector, and manually select the instance of a polymorphic VI.

Related Information

Polymorphic VIs

Choosing between Malleable VIs and Polymorphic VIs


Not Helpful