https://home.simpleone.ru/record/safe_story/160520607613610616

СОРС: 


Choice is .... It is used for... In SimpleOne interface, it is displayed as a drop-down list.


There are two ways to define a set of choices for the drop-down lists:

In the first case, the choice field inherits the values from a parent table. To create a different set of choices, you need to make another set using the Choice Options dictionary.


Create a choice column


This field can contain all kinds of symbols. If the string length is not set then it is limited to 80 symbols.

  1. Navigate to System Definition → All Columns.
  2. Click New, and fill in the fields.
  3. Click Save or Save and Exit to apply changes.

/ есть другой способ попасть туда → через Related Lists в форме создания колонки типа Choice /

FieldMandatoryDescription
TableY

Specify the table name that will be a parent for this column. This mandatory field is a reference to the Tables dictionary (sys_db_table).

Column TypeY

Specify a column type. The column type specifies the type of the data stored, also, depending on the type selected, additional tabs or fields may appear on the form (see below). For more information, see the Field Types article.

TitleYA column title displayed on the form. It is preferred to be sensible and human-readable. This field is mandatory. Latin, Cyrillic, [0..9] numbers, and the underscore symbol ( _ ) are allowed.
Column NameY

A system column name. It is preferred to be human-readable and keep the kind of stored data. Latin letters, [0..9] numbers, and the underscore symbol ( _ ) are allowed.

ActiveN

Select this checkbox, and customizing of this field displayed on the form and list will be possible.

If unselected, then such field will be not available for choosing in Form Layout or List layout.

Read OnlyNSelect this checkbox to make the field read-only.
MandatoryNSelect this checkbox to make the field mandatory.
Full Text SearchNSet this attribute equal to TRUE to make it possible to perform a Global Search against the current column.
Display by RefN

When a record references to another record and the table or column containing this record has the attribute Display by Ref equal to TRUE, then the column value will be displayed.

By default, this attribute is set equal to TRUE for the sys_id column (this column contains unique IDs).

If a table contains a field that has Display by Ref = TRUE, the value of this field will be displayed when referencing this table in the Reference field of the referencing table.

UniqueNWhen turned on, no way to add a record with a value of this field, if a record with the same value already exists.
CommentsNWrite a comment with the additional information to a problem.
Type Specification tab
Choice TableNReference to a table.
Choice TypeY

Available options:

  • Dropdown with --None--
  • Dropdown without --None-- (must specify a default value).

If the Dropdown without --None-- is chosen, the Dafault value tab becomes mandatory.

Choice FieldYReference to the specified field of the table. Its values will be available for the Choice field.
Default Value tab
Default ValueNThe field is not mandatory if the Choice Type is Dropdown with --None--.
Use Dynamic DefaultNCheck this box for the Dynamic Default field to appear.
Dynamic DefaultN


Create a choice option


Before creating a set of options for a particular table and column, please make sure that this column is already created (navigate to System Definition → All Columns).

To create a choice option for a column table, please perform the following steps:

  1. Navigate to System Definition → Choice Options.
  2. Click New, and fill in the fields.
  3. Click Save or Save and Exit to apply changes.


An easier way to quickly create a set of options for the same column is to use Insert and Stay. In the burger menu, choose Insert and Stay. A copy of the current choice option record will be created. Change the Title, Value, and Order fields.

Choice option form fields

FieldMandatoryDescription
TableY

Specify the table to which this choice option is related.

Select the same table for the translated version as for the original one.

ColumnY

Specify the column to which this choice option is related.

Select the same column for the translated version as for the original one.

TitleYType the translation of the source field there.
LanguageYIn there, 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.
ValueYType the same value as specified for the source field.
OrderYEnter the number to define the option order in the choice list.
HintNText hint. This field is not mandatory.


/ можно сразу создать перевод для опций с помощью Insert and Stay, изменяя поля Title, Language, оставляя без изменений поле Value /



Inheritance


Defining an override for choice fields


When creating a choice-like field (for example, Choice), 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.

Regarding task states, it makes sense to make values numerical; this can help with selection construction (see the code sample below).

addQuery

task.addQuery('state', '>', '2'); // all states after In Progress


Choice list translation


To localize a choice list, please complete the steps below:

  1. Navigate to System Definition → Choice Options.
  2. Click New and fill in the field.
  3. Click Save or Save and Exit to apply changes.

Translated choice option form fields

Field

Mandatory

Description

TableY

Specify the table to which this choice option is related.

Select the same table for the translated version as for the original one.

ColumnY

Specify the column to which this choice option is related.

Select the same column for the translated version as for the original one.

TitleYType the translation of the source field there.
LanguageYIn there, 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.
ValueYType the same value as specified for the source field.
OrderYEnter the number to define the option order in the choice list.
HintNText hint.

Repeat this step for the rest of the options on the list.

If some of the choice options were not localized (for example, some added choice options in English but didn't add their translations), then in 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.  


Choice option order