Unit Set
The Unit Set node contains lists that can be used by combo boxes, radio buttons, or list boxes for the purpose of changing units. The Settings window for a unit set contains two sections: Unit Groups and Unit Lists.
Each row in the Unit Groups table is a unit group that represents a collection of units with a particular meaning in the context of the application user interface. Each column represents a group of units labeled by a Value and a Display name.
Each row in the Unit Lists table is a unit list with columns containing units with the same dimension, for example, mm, cm, dm, m, and km. The headings of the Unit Lists table are Name and the Display names are defined in the Unit Groups section. A unit list specifies the possible units that a form object that references the Unit Set can switch between when running the application.
The figure above demonstrates the use of a Unit Set for an application that allows for switching between metric and imperial units. In this example, two unit groups are defined: SI and Imperial.
The Value column contains string values that represent the current choice of unit group. These string values can be manipulated from methods. The Display name column is the string displayed in the user interface. The Initial value list contains the default unit group (SI in the example above).
In the example above, the Unit Lists table has three columns: Name, SI, and Imperial. The SI and Imperial columns are created dynamically based on the groups in the Unit Groups section. Each row in the table corresponds to a physical quantity such as, in this example, length and potential. Each column in the table corresponds to the allowed units of length and units of potential, respectively.
The figure below shows an example application where a combo box form object is used to choose between the SI and Imperial unit groups.
The figure below shows the Settings window of a combo box using the Unit Set of the above example as the Source.
In this way, a Unit Set can be used instead of a Choice List to create a combo box for unit selection. Instead of a combo box, you can use a list box or a radio button object in a similar way.
The two figures below show the corresponding Settings windows for the two input fields for Length and Applied voltage.
The Unit dimension check is set to Append unit from unit set. The Unit set is set to Unit Set 1{unitset1} (the user-defined label for the Unit Set declaration used in this example). The Unit list is set to length and potential, respectively. When using Append unit from unit set, the Numerical validation section (under Data Validation) refers to the Initial value of a Unit Set; in this case, cm and mV, respectively. The Lower bound and Upper bound values are scaled automatically when the application is run and the unit is changed by the user of the application. For more information on the settings for an input field object, see Input Field.
The figures below illustrate the use of two Unit Set declarations for separately setting the unit for length and potential, respectively.
The figures below show the corresponding Settings window for the Unit Set declarations.
Note that, in this example, by using additional Unit Set declarations, you can have individual length unit settings for the Length and Width input fields. The figure below shows such an example, where three combo boxes have been used to replace the unit labels and each combo box uses a separate Unit Set declaration as its source.
When more flexibility is required, you can combine the use of a Choice List and a Unit Set. For example, for a combo box, you can use the Unit Set as the Selected source (string) and select a Choice List that is not a Unit Set.