Polymorphic VIs accept different data types for a single input or output terminal. A polymorphic VI is a collection of subVIs with the same connector pane patterns. Each subVI is an instance of the polymorphic VI.
For example, the Read Key VI, located on the Functions»File I/O»Configuration File VIs palette, is polymorphic. Its default value terminal accepts Boolean, double-precision floating-point numeric, signed 32-bit integer numeric, path, string, or unsigned 32-bit integer numeric data.
Build your own polymorphic VIs when you perform the same operation on different data types.
Note You can build polymorphic VIs only in the LabVIEW Professional Development System.
Complete the following steps to build a polymorphic VI.
Create two or more VIs with the same connector pane pattern. Make sure the connector panes have corresponding input and output terminalsif a terminal in the connector pane of one VI is an input, the corresponding terminal on 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.
Select Polymorphic VI in the listbox and click the OK button to display the Polymorphic VI dialog box.
Click the Add VI button to display the Choose the VI to open dialog box.
Select a VI to include in the polymorphic VI and click the Open button. The VI appears at the top of the SubVIs list. This subVI determines the default connector pane pattern for the polymorphic VI.
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 can still save the polymorphic VI. To change the order of the subVIs, select a subVI in the list and click the up arrow or down arrow button.
Note Double-clicking a subVI in the SubVIs list opens the subVI.
Click the Edit Icon button to create an icon for the polymorphic VI.
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 VIs that compose the polymorphic VI. Therefore, you must create a description for the polymorphic VI.