A choice field provides several predefined options to choose from, and only one option can be selected.
In SimpleOne interface, choice fields are displayed in two ways:
|
This column database value can contain all kinds of symbols. If the string length is not set, then it is limited to 80 symbols.
To create a choice column, complete the following steps:
You can also open the form this way:
Please note that in this case, you will need to fill in the Table field manually. |
Field | Mandatory | Description | |
---|---|---|---|
Table | Y | Specify the table name that will be a parent for this column. This field is a reference to the Tables dictionary (sys_db_table). | |
Column Type | Y | Specify the Choice column type. | |
Title | Y | Specify a column title displayed on the form. It is preferred to be sensible and human-readable. You can use Latin, Cyrillic, [0..9] numbers, and the underscore symbol ( _ ). | |
Column Name | Y | A system column name. This field is populated automatically. Latin letters, [0..9] numbers, and the underscore symbol ( _ ) are used. | |
Comments | N | Write a comment with the additional information. | |
Active | N | Select the checkbox to make it possible to add this field on the form and list. If unselected, then field will be not available for choosing in Form Layout or List layout. | |
Read Only | N | Select this checkbox to make the field read-only. | |
Mandatory | N | Select this checkbox to make the field mandatory (appropriate for Choice columns with Choice Type = Dropdown with -- None --). | |
Full Text Search | N | Select this checkbox to enable Global Search for the current column. | |
Display by Ref | N | Select this checkbox to display the column's value in record titles and references. | |
Unique | N | Select this checkbox to forbid creating records with equal values in this field. If a record with value X already exists, there is no way to add a record with the same value. | |
Type Specification tab | |||
Choice Table | N | Reference to a table. | |
Choice Type | Y | Define whether the option "None" is applicable for the field. Available options:
If the Dropdown without --None-- is chosen, the Default Value tab becomes mandatory. | |
Choice Field | Y | Reference to a particular column of the table specified in the Choice Table field. | |
Extra Attributes | N | Enter the text below to apply radio buttons style to the choice field:
| |
Default Value tab | |||
Default Value | N | The value of a choice option to be populated automatically by default. Check the value of a field in Choice Options dictionary (sys_choice). The field is mandatory if the Choice Type is Dropdown without --None-- (specify a default value). | |
Use Dynamic Default | N | Select this checkbox to specify the Dynamic Default field. | |
Dynamic Default | N | Select the script from the Dynamic Default Values (sys_default_value_dynamic) dictionary, so its execution result will be automatically calculated and entered into this field. This value will be the default value for the column specified. This field appears only when the Use Dynamic Default checkbox is selected.
|
There are three ways to define a set of choices for the drop-down lists:
In the second case, you may need to create a different set of choices if the column is inherited and has predefined options. See Overriding of choice options set for child table to learn more.
In the third case, the available options are taken from a particular column of a source table. In the example below, the choice table Role contains a column Name and some records where Name is not empty. The choice options will be values of the Name column in this table.
Before creating a set of options for a particular table and column, make sure that this column is already created (navigate to System Definition → All Columns). |
To create a choice option for a column table, perform the following steps:
You can also open the form this way:
Note that in this case, you will need to fill in the Table and Column fields manually. |
Choice option form fields
Field | Mandatory | Description |
---|---|---|
Table | Y | Specify the table to which this choice option is related. Select the same table for the translated choice version as for the original one. |
Column | Y | Specify the column to which this choice option is related. Select the same column for the translated choice version as for the original one. |
Title | Y | Type the translation of the source field there. |
Language | Y | Specify the two-symbol name of the language (ru, en, and so on). Generally, references to languages are stored in the Languages (sys_language) table. |
Value | Y | Type the same value as specified for the source field. |
Order | Y | Enter the number to define the option order in the choice list (options are arranged in the ascending order). |
An easier way to quickly create several options for the same column is to use Make a copy:
You can also use the following way to create a translation for the choice options:
Note that the Value field has to remain unchanged. |
Override allows for changing choice options set for the child tables extended from the base table. For example, the parent table has the following options for a choice column State:
An overriding can change the quantity of these options or their values in the child table. For example, the new set for the State field can be the following:
When creating a choice field, it is recommended to set text values in the Value field to increase code readability. For example, it can be incoming, or active, or failed values for Incoming, Active, and Failed choice options.
As for task states, it makes sense to make values numeric; this can help with selection construction in code. |
To create a new option set, perform the following steps:
You also can find the form this way:
Please note that in this case, you will need to fill in the Task and Column fields manually. |
To learn how to change the column attributes, refer to the Column Overriding article.
You can provide a set of options for a choice field with localization, which will be displayed in the user's locale.
To localize a choice list, please complete the steps below:
An easier way to quickly localize a set of options for the same column is to use Make a copy.
Note that the Value field has to remain unchanged. |
If some of the choice options are not localized, then in a user locale other than English, choice lists containing untranslated options will display them in English by default, regardless of the current user locale. To avoid this, please be careful when adding options to your choice lists. |