A Select field is designed to allow selecting of one or many values from a predefined list. The available choices are displayed in a list. The user can choose one or multiple values depending on how the field is configured.
An example of a Select Field.
The select field has the following design options:
Multiple
is enabledArchitectural Notes:
The selected values map to a bitwise value in the database that extreme performance when querying even when in multi-select mode.
In Form Designer you can add a select field by dragging the select field icon onto the form from the toolbar.
Double clicking a select field in Form Designer will display the select field's Properties, Security, and History.
In addition to the Default Field Properties Select fields expose the following additional properties:
Clearable:
Clearable select fields will render with an "X" icon. When clicked the value in the field will be cleared.
Multiple:
Allows users to select multiple values in the same field.
Counter:
When used with Multiple, shows the count of selected values.
Maximum Selected Values:
When used with Multiple, limits the total number of selections.
There are several valid ways to set a select field's value in script.
Setting a select field with an Option Label.
$current.new_select_field_2 = "test4";
Setting a select field with an Option Value.
$current.new_select_field_2 = 2;
Clearing a select field with an empty string.
$current.new_select_field_2 = "";
Clearing a select field with a value of zero (0).
$current.new_select_field_2 = 0;
Setting a multiple select field with an array of Option Labels.
$current.new_select_field_1 = ["Test1", "test9"];
Setting a multiple select field with a single Option Label.
$current.new_select_field_1 = "test12";
Setting a multiple select field with a numeric array of Option Values.
$current.new_select_field_1 = [1, 2, 4, 64, 2147483648];
Setting a multiple select field with a bitwise numeric value. 37 in this case would represent the first (1), third (3), and sixth (6) options in the select field.
$current.new_select_field_1 = 37;
Setting a multiple select field with a single numeric Option Value. 8 in this case would represent the fourth (4) option in the select field.
$current.new_select_field_1 = 8;
Setting a multiple select field with an empty string will clear the select field.
$current.new_select_field_1 = "";
Setting a multiple select field with a numeric zero (0) will clear the select field.
$current.new_select_field_1 = 0;
There are multiple ways to read a select field in Platform script:
This may be a TODO!
Test if a single choice select field has a specific value selected using the equals() method.
if ($current.select_field.equals("Value 1")) {
$ps.toast("Select field has Value 1 Selected");
} else {
$ps.toast("Select field does not have Value 1 Selected", ToastType.negative);
};
Test if a multiple select field has a specific value selected using the includes() method.
if ($current.select_field.includes("Test1")) {
$ps.toast("Select field has Test1 selected");
} else {
$ps.toast("Select field does not have Test1 selected", ToastType.negative);
};
Test if a multiple choice select field has multiple choices selected using the hasFlag() method.
if ($current.select_multiple.hasFlag("Test3", "Test4")) {
$ps.toast("Select Multiple has Test3, Test4 Selected");
} else {
$ps.toast("Select Multiple Does Not Have Test3, Test4 Selected");
};
Details about query operators are available here: ps-queryoperators
Other than the basic field security model Select fields require that the user accessing the fields also have the appropriate access to the selected form and field as well.
Details about field security are available here: Field Security
TODO: Link to the basic field history document that doens't exist yet (Probably nothing specific to select fields here)
Details about field accessibility are available here: Accessibility