In logic, a
ValueSet is an object that contains information about the
possible values that are considered permissible for a field. Each possible value contains a label, a code (the valid value), and can contain a link to an
image shown when the value set is
displayed. The ValueSet object, once passed to the
setvalueset function, becomes an item's dynamic value set.
A ValueSet is a CSPro logic object and the following functions can be called via
dot notation:
Function | Description |
add | Adds a single value, or all the values from an existing value set, to the value set. |
clear | Removes all values from the value set. |
length | Returns the size of the value set. |
randomize | Randomizes the order of entries in the value set. |
remove | Removes the value with the specified code from the value set. |
show | Displays the value set's labels (similarly to accept) and returns the code of the operator's selection. |
sort | Sorts the order of entries in the value set by either label or code. |
|
getLabel | Returns the symbol's label. |
getName | Returns the symbol's name. |
getJson | Returns the symbol's metadata and value represented in JSON. |
getValueJson | Returns the symbol's value represented in JSON. |
updateValueFromJson | Modifies the symbol based on a JSON representation of the value. |
In addition to these object functions, ValueSet objects contain two built-in
List objects:
valueset_name.codes and
valueset_name.labels, which contain the codes and labels for the value set. These are read-only List objects and can be used in most ways that List objects can be used.
ValueSet objects can be assigned to other ValueSet objects, which will replace the initial value set with the values of the assigned value set:
valueset_name = another_valueset_name;