Skip to main content
Version: 2023 R2

Choice tree

The field allows you to display values in a form of a tree and select one of them. There are two ways of configuring the data source to be displayed in the tree: by using ParentID or paths. You can also turn on the asynchronous data downloading mode. In this mode first only one level of the tree is built and other levels are loaded if necessary.

  • Configuration by using ParentID

Three columns must be included in the data source configuration: a column indicating the ID (first), a column indicating the displayed name (second), and a column called ParentID. The latter column is used to build the tree – the values from that column are paired with ID values. For example, if the value "1" is present in the ParentID column data record, that data row is placed one level below in the tree hierarchy than the record with an ID of "1", thus becoming its child. If no value in the ParentID column is entered, that record is placed at the top of the tree hierarchy, thus becoming the tree root.

  • Configuration by using paths

In this mode it is necessary to return a correctly formatted displayed name. The first column in the configuration is regarded as the ID column and the second one as a column with the displayed name. The displayed name must be returned in the following format: <1st level display name>;/<2nd level display name>/<3rd level display name>/. The tree is constructed based on the sequence of displayed names. For example, if the returned value is "1/2", the record is placed on the second level of the hierarchy under the node of "1", i.e. "2" will become the child of "1". Remember that you can only select leaves (end values) from the tree. After returning two values "1" and "1/2/3" from the data source, a three-level tree is built with subsequent nodes "1", "2", and "3". However, you can select only the end nodes (leaves), i.e. in this case nodes "1" and "3".

The Choice tree form field detects the presence of a column named ParentID and will use the correct mode automatically.

info

To learn more about the Choice tree form field, read the ARTICLE available in the WEBCON Community website.

Advanced configuration

The tab contains a number of options that enable detailed configuration of the Choice tree form field.

drex_ChoiceTreeConfig_screen.png

1. Columns

A list of columns used by the Choice tree form field. Each row contains the following options:

  • Source column – the name of a column in the data source,
  • Display text – the name that appears in the pop-up dialog window. You can provide translations for the display name which will be used depending on the user's Portal profile language.

The table's first row corresponds to the column whose value is stored as a Choice tree entry identifier. The source column should contain unique values. The second table's row represents a column whose value will be displayed in the field after selecting the value.

2. Query data source if variables return empty values

The checkbox allows you to define whether the system will allow to use tags with empty values. Once checked, a query containing tags with empty values in the Choice tree will not return any results.

3. Empty element display name

The name to be displayed in the drop-down list that indicates whether the value in the Choice tree has been selected, e.g. entering the name "---Select---" results in displaying such an item in the drop-down list. When a user selects such a value, the system regards it as a non-selection. If a form field is set as required, it is not possible to proceed to the next step.

4. Allow selecting values no longer available in the data source

This option causes the values ​​saved in the database to be added to the Item list in the drop-down list. The functionality is useful when records have been removed from the data source. The instances saved in the database will have archival value and on new instances you will be able to choose only current values ​​present in the data source.

5. Load data asynchronously

The option is used by the Choice field (tree) column on the Item list. When checked, asynchronous data loading is activated – the data are loaded when expanding items on the tree (clicking the nodes). When unchecked, all data are loaded at once.

6. Sort by Display Field

If you select the checkbox, the values are sorted with reference to the field set as a display field. It is the second row of the configuration table of the Choice field columns.

7. Allow also choosing intermediate nodes

The checkbox is available only for the configuration of the Choice field (tree) column on the Item list when the tree structure is defined by the ParentID column.

8. Support multi language names

The option allows you to activate translations provided for the user's profile language.

info

To learn more about multilingual names, read the ARTICLE available in the WEBCON Community website.

Example

./img/drex_ChoiceTree_custom_2.png