# Field

## Getting Started

Starting in the **Class Designer,** click on the down arrow on the left side of the class you wish to work on. Next, expand the **Fields** for the class. Go to **Add a new field** and enter the name of your field. Press **Enter** to open the field editor.

{% hint style="info" %}
Clicking on an existing field opens it in the field editor to allow changing its configurations.
{% endhint %}

![Class designer: Creating a new field](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBG89sfc5p_vTBzIR1t%2F-MBG9YZqF4ooO1Lu3B8h%2FCreate_Field-min.gif?alt=media\&token=1b458c9f-17fc-4731-9e77-919ec0f7671b)

## Common Attributes

The Common section contains general properties of a field. In this section, you can specify how the field is presented in your application by setting the name, description and other information.

![Common attributes for a field](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBFfgZKUZBCAGTx8HWK%2F-MBFg2L4KjU-iTblJnoS%2Fimage.png?alt=media\&token=db9162f1-59bd-4465-a46c-9f74fd6076ce)

### Key

The field key is an internal label for the field in your application.

Field keys are typically used when querying data to define which information to output from a particular query. More information about data queries can be found [here](https://docs.tivity.one/building-an-application/data/query-data).

{% hint style="info" %}
The **Key** field is compulsory when creating a field.
{% endhint %}

### Internal Key

The internal key is a unique identifier for your field and defines your field name in the database.

{% hint style="info" %}
The **Internal Key** field is compulsory when creating a field.
{% endhint %}

### Name

This is the name that is displayed in the application. By clicking on the globe icon, you can define a name for every language.

{% hint style="info" %}
The **Name** field is compulsory when creating a field.
{% endhint %}

### Description

The field description provides additional information to help the user navigate through your application. It can also be used as a hover text.

### Data Type

This field determines what type of data is allowed by the field and saved in the database.

{% hint style="info" %}
The **Data Type** field is compulsory when creating a field.
{% endhint %}

![List of datatypes in field editor](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBFfgZKUZBCAGTx8HWK%2F-MBFgWLmSyL_SCoYIDFi%2Fimage.png?alt=media\&token=43ab0e16-977b-4383-9c47-5479a20e6004)

Based on the data type, different [control type](#control-type) options are made available for the user to enter a value for the field.

| **Any**       | Label, Html                                                                                                                      |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **Guid**      | Label, TextBox, ComboBox, Slider, Html                                                                                           |
| **Boolean**   | Checkbox                                                                                                                         |
| **String**    | Label, TextBox, ComboBox, EditComboBox, Slider, Password, TextArea, Email, Phone, Address, Url, HtmlEditor, MarkdownEditor, Html |
| **DateTime**  | Label, TextBox, Calendar, DatePicker, TimePicker, Html                                                                           |
| **Integer**   | Label, TextBox, ComboBox, EditComboBox, Slider, Html                                                                             |
| **Byte**      | Label, TextBox, ComboBox, EditComboBox, Slider, Html                                                                             |
| **Short**     | Label, TextBox, ComboBox, EditComboBox, Slider, Html                                                                             |
| **Long**      | Label, TextBox, ComboBox, EditComboBox, Slider, DurationPicker, Html                                                             |
| **Float**     | Label, TextBox, ComboBox, EditComboBox, Slider, Html                                                                             |
| **Double**    | Label, TextBox, ComboBox, EditComboBox, Slider, Html                                                                             |
| **Numeric**   | Label, TextBox, ComboBox, EditComboBox, Slider, Html                                                                             |
| **ByteArray** | Preview                                                                                                                          |
| **Char**      | Label, TextBox, ComboBox, EditComboBox, Slider                                                                                   |
| **Xml**       | Label, TextBox, TextArea, Content, ComboBox, Slider, Html                                                                        |

### Control Type

The field control type defines the editor with which a user can interact with the field. Control type options vary based on the data type selected for the field. Below is a list of different control types and how they can be used.

#### **Label**

Labels are used to present a single line of text. The control type 'Label' (or item appearance 'Label') shows the value of the field without the possibility to edit it. The field is visualized like a read-only field without the effects.

{% hint style="info" %}
Supported data types:\
Any, Guid, String, DateTime, Integer, Byte, Short, Long, Float, Double, Numeric, Char, Xml
{% endhint %}

![Sample label control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MT6Y4qIH0FkcoZJ2sHh%2F-MT6bMQ4W26liJXod6Fy%2FClassField-LabelType.png?alt=media\&token=b56c80a0-4f21-48c8-936e-03165e36648b)

**TextBox**

Textboxes allows the user to enter a single line of text.

{% hint style="info" %}
Supported data types:\
Guid, String, DateTime, Integer, Byte, Short, Long, Float, Double, Numeric, Char, Xml
{% endhint %}

![Sample textbox control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJJicSLp51vg00NcHG%2F-MBJKtC9uGCI36sMpLc0%2Fimage.png?alt=media\&token=2f018432-a2d3-4e6c-98e3-24ce7c3812c1)

#### Calendar

The calendar control is a combination of a Date Picker and a Time Picker to allow the user to select both a date and a time as input.

{% hint style="info" %}
Supported data type: DateTime
{% endhint %}

![Sample calendar control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJ1ATb_L75P5N2aC0N%2F-MBJ1OQ3wTBr9SfR7vH6%2Fimage.png?alt=media\&token=0181f784-e155-45f2-91ad-d643f8e4342b)

#### DatePicker

The date picker control is a textbox that is equipped with a calendar for easier date input.

{% hint style="info" %}
Supported data type: DateTime
{% endhint %}

![Sample Date Picker control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJ-N4o8JCF7wgv33aR%2F-MBJ-pbyKv2nkLQzj4aj%2Fimage.png?alt=media\&token=e2b32f02-7988-4aef-84c5-180236829e9a)

#### TimePicker

The time picker control is a textbox that is customized for easier input of time value.

{% hint style="info" %}
Supported data type: DateTime
{% endhint %}

![Sample Time Picker control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJ1ATb_L75P5N2aC0N%2F-MBJ1c_2cXpaHum80yE2%2Fimage.png?alt=media\&token=0b04f1b5-35f0-4b4b-ba3c-256b52036c28)

#### **ComboBox**

Combo-boxes are used to select a single value from a given set of options. By choosing this control type, additional configurations are presented to the user to configure the combo-box set of options.

{% hint style="info" %}
Supported data types:\
Guid, String, Integer, Byte, Short, Long, Float, Double, Numeric, Char, Xml
{% endhint %}

![Sample combo-box control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJE-hUz_Er9WvNl8Uw%2F-MBJIB1yCAA0juN0fTHL%2Fimage.png?alt=media\&token=f26dbd06-e802-4c3f-abce-63ebcf45c4a7)

Based on the **Data Source Type** selected, different fields are presented to finalize the source of combo-box options.

1. **None**\
   No data source defined for the option list leaving it blank.\
   &#x20;<img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJE-hUz_Er9WvNl8Uw%2F-MBJHOk94U2_jxtdJmUC%2FCombobox-none.png?alt=media&#x26;token=646fc688-9a7b-4ebb-89e6-408092a97bee" alt="" data-size="original"> <br>
2. **Class**\
   The user can set which class and field to read from to populate the combo-box options.\
   &#x20;<img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJE-hUz_Er9WvNl8Uw%2F-MBJHclaiTtGcU0RNEqh%2FCombobox-class.png?alt=media&#x26;token=508e9078-ae52-46e0-a814-2b3d3750b3ea" alt="" data-size="original"> <br>
3. **Controller**\
   The user can use code from a controller to determine how the options list should be built.\
   &#x20;<img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJE-hUz_Er9WvNl8Uw%2F-MBJHkHFh1wDkk8YiEsb%2FCombobox-controller.png?alt=media&#x26;token=093b5d33-2989-413b-abe8-9e6d75501797" alt="" data-size="original"> <br>
4. **Option**\
   The user can manually add possible options in a multi-line textbox (one option per line).\
   &#x20;<img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJE-hUz_Er9WvNl8Uw%2F-MBJHo_82qdTiUh3V9jo%2FCombobox-options.png?alt=media&#x26;token=a7183c0d-7542-4699-baf4-5246d297a8e7" alt="" data-size="original">&#x20;

For Combo-boxes an automatic pagination mechanism is implemented. So even if there are dozens of options there won't be any performance issues when user is searching through the options.

{% hint style="info" %}
An alternate version of the combo-box is the **EditComboBox** control type which has the same configuration options as a normal combo-box.

However, input values for an edit-combo-box is not limited to the option set provided. Users can enter custom values in the input box.
{% endhint %}

#### **Slider**

Sliders allow the user to choose a value graphically. Additional **Options Source** configurations are provided to the user when this control type is selected. These configurations define which options are made available when using the slider.

{% hint style="info" %}
Supported data types:\
Guid, String, Integer, Byte, Short, Long, Float, Double, Numeric, Char, Xml
{% endhint %}

![Sample slider control type](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJT6tzdNLWO_o5RuQC%2F-MBJUBR3-cR6nTdPROAf%2FSlider.gif?alt=media\&token=da492939-4169-4a86-a6aa-9d7f74106c0c)

With your data source configurations set, your slider will be ready for use in your application.

#### Password

Password fields are displayed with a single line of escaped text. By default, the password is masked using dots. Selecting the eye icon on the right of the textbox allows the password to be viewed as plain text.

{% hint style="info" %}
Supported data type: String
{% endhint %}

![Sample password control - hidden](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJE-hUz_Er9WvNl8Uw%2F-MBJEfv8FKhDDX88Spc-%2Fimage.png?alt=media\&token=c856b82a-d960-43e5-b5a9-a89827fe8a57)

![Sample password control - visible](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJE-hUz_Er9WvNl8Uw%2F-MBJEr9eabZZDl-tKqfJ%2Fimage.png?alt=media\&token=de81dfe1-bdcd-49e0-8696-7d4432b3e364)

#### TextArea

This allowed the user to input multiple lines of text. In the bottom right corner of the input box, a resize option is provided allowing you to increase the height of the text area.

{% hint style="info" %}
Supported data types: String, Xml
{% endhint %}

![Sample text area control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJ8To_6LNI_ZozVUZ_%2F-MBJ9UBIoKCIk3OOGnju%2Fimage.png?alt=media\&token=160b3335-a5d5-4463-b6c7-72366c16d25d)

#### URL

URL control types allows a single line of text to be entered. The input box is customized for adding hyperlinks. An option on the right of the input box allows you to open the hyperlink in a new tab.

{% hint style="info" %}
Supported data type: String
{% endhint %}

![Sample URL control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJ5DNZajg42SeXUnYD%2F-MBJ8Q41EY_XZafzP7yL%2Fimage.png?alt=media\&token=3c26987c-db74-49f8-a3c9-c102d1341011)

#### HtmlEditor

Html Editors allows the user to create and edit content in html format - allowing for easier combinations of multimedia and text.

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2FqOYo71nmS8YhPGEDz1UM%2FHtmlEditor_FieldControlType.png?alt=media&#x26;token=cacbe99a-16e3-4383-892c-917cf799e99f" alt=""><figcaption><p>Field Control Type HtmlEditor</p></figcaption></figure>

{% hint style="info" %}
Supported data type: String
{% endhint %}

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2Fze5ZpNMNq84Z3qiXAXuk%2FEditHtml_LayoutDesigner.png?alt=media&#x26;token=7214f65a-d1a6-44bc-aa12-a16d66d82aaa" alt=""><figcaption><p>HtmlEditor field in the Layout Designer</p></figcaption></figure>

![Sample HtmlEditor on the Page](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJ8To_6LNI_ZozVUZ_%2F-MBJ8g8f7PJIIKPRcC5w%2Fimage.png?alt=media\&token=dcd6e37c-f55f-4b45-996e-1783c19a4c49)

#### Html

Displays the value of the field as HTML in non-editable format.&#x20;

{% hint style="info" %}
Supported data type:&#x20;

Any, Guid, String, DateTime, Integer, Byte, Short, Long, Float, Double, Numeric, Xml
{% endhint %}

#### MarkdownEditor

Markdown Editors allows the user to create and edit content in markdown format - allowing for content consisting of text and multimedia to be created while reducing the complexity of content creation compared to HTML.

{% hint style="info" %}
Supported data type: String
{% endhint %}

#### Email

Email control types allows a single line of text to be entered. The input box is customized for email input.

{% hint style="info" %}
Supported data type: String
{% endhint %}

![Sample email control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJ3qgobS_BXB-6Ai9P%2F-MBJ55lkbvfmhsSP6etV%2Fimage.png?alt=media\&token=ee577e88-4c0b-4152-b744-51faade6c673)

#### Phone

Phone control types allows a single line of text to be entered. The input box is customized for phone entry.

{% hint style="info" %}
Supported data type: String
{% endhint %}

![Sample phone control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJ1hShi8vvw9xKxzm5%2F-MBJ3fMZ66UCgLhDqk1q%2Fimage.png?alt=media\&token=ec515935-bb31-441c-bae8-366a1dd20fc7)

#### Address

Address control types allows a single line of text to be entered. The input box is equipped with an option to open your address on Google Maps so you can confirm the location.

{% hint style="info" %}
Supported data type: String
{% endhint %}

#### Preview

The preview control type works with images stored as byte arrays. Using this control, the byte-array is rendered into the original image in your application.

{% hint style="info" %}
Supported data type: ByteArray
{% endhint %}

![Sample preview control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJMrYtQRIOaQC5Md3f%2F-MBJOdK7SBoEWNsueizV%2Fimage.png?alt=media\&token=f8df8467-9f3c-4c16-9773-0a0a33bfec84)

#### Content

The content control type can be used with XML content. Similar to text-areas, it allows the user to increase the height by using a resizer at the bottom right corner of the input box.

{% hint style="info" %}
Supported data type: Xml
{% endhint %}

![Sample content control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBJMrYtQRIOaQC5Md3f%2F-MBJPlInJrx7lUiCakBG%2Fimage.png?alt=media\&token=21fb5251-508a-4997-9d0b-f6055820e9f8)

#### DurationPicker

The control type gets ticks and displays them as a duration (TimeSpan). Upon changing the duration, the new value gets saved as ticks (Long). The DurationPicker can be configured (in layout designer) to only display some of the different parts (days, hours, minutes and seconds).

Ticks are defined as 10,000 ticks per millisecond.

{% hint style="info" %}
Supported data type: Long
{% endhint %}

![Sample duration picker control](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MSmlL0aDhC_uanA620r%2F-MSmlbzYAj4ZKPnlgayp%2FDurationPicker.png?alt=media\&token=9d7817ee-b0a5-4766-9b78-5cfd8c620822)

### Data Source Type

#### Class

Data Source Type Class is selectable for control types ComboBox, EditComboBox and Slider.

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2FhNiUtbOE6fQEyyK8JQBG%2FField_DataSource_Type_Class.png?alt=media&#x26;token=6aa40c1a-2619-48c6-b576-4f4daa87adc8" alt=""><figcaption><p>Data Source Type Class Usage Sample</p></figcaption></figure>

Selection of Data Source Type Class requires additionaly selection of the class which will serve as a data source and the field of the chosen class.

#### Selection

Data Source Type Selection can be chosen for the Control Types ComboBox, EditComboBox and Slider.

In data source type “Selection” a selection can be selected to be used when a field value is to be selected.

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2FaYG5qpYPjtbdYbG8yNF6%2FDocumentation%20-%20Data%20Source%20Type%20Selection.png?alt=media&#x26;token=cdca1ce4-49e7-4943-9f3c-f163bc894fae" alt=""><figcaption><p>Data Source Type Selection Usage Sample</p></figcaption></figure>

Is the data source type Selection chosen, the following fields can be filled:

* Selection (required): A selection to choose from. All selections without a context or selections with a context matching the context of the parameter. For Field, Action-Parameter, Template-Parameter and Workflow-Parameter of the configured class is the matching context. For Selection-Parameter the context class is the matching context.
* Key field (required): A field of the selection to use as identification of each entry. The value will be used to store in a class field or parameter. Only fields of the same selection source can be selected.
* Name field (required): A field of the selection to use to display each entry. This can be the same as the key field. Only fields of the same selection source can be selected.

| Field                             | Required | Remarks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| --------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Data Source Type                  | Yes      | The type of data source. Must be “Selection”.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Selection                         | Yes      | The selection that is used as the data source.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Key Field                         | Yes      | The field of the selection used as the key field. The value of the key field is saved in the field that is being configured.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Name Field                        | Yes      | The field of the selection used as the name field. The value of the name field is displayed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Parameter Default Values (Script) | No       | <p></p><p>A script executed before parameters of the chosen selection are evaluated. The script should fill variables named after parameters used in the selection. The script gets to following variables passed:</p><ul><li>Context.OfficeId (Guid): The ID of the office/ workspace the selection will be executed in.</li><li>Context.ApplicationId (Guid): The ID of the app the selection will be executed in.</li><li>Context.ClassId (Guid): The ID of the source class of the selection.</li><li>Query.ContextLinkId (Guid): The ID of the link between the class of the field and the class of the selection class (when applicable).</li><li>Query.ContextClassId (Guid): The ID of the class of the field.</li><li>Query.ContextInstanceId: The ID of the instance which field value is to be changed.</li></ul> |

#### Controller

Controllers Data Source Type can be chosen for the Control Types ComboBox, EditComboBox and Slider. You get a selection of controllers for different tasks.

![Field details](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MSmrtbkjObbPR8EZCIo%2F-MSmw60YTEUKTQdas22p%2FFields-SourceController.png?alt=media\&token=0a661fd7-6199-401e-9bb8-98eb8e60d1f6)

#### Option

Data Source Type Option can be chosen for the Control Types ComboBox, EditComboBox and Slider. With this type you can enter the selection possibilities manually.

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2FpoG2XaEkwaUnQKE3q3bw%2FClassDesigner_DataSourceOption.png?alt=media&#x26;token=905b1db4-349d-4733-b6e5-e2e1c801fa88" alt=""><figcaption><p>Data Source Type Option with Sample Options</p></figcaption></figure>

Data source option can include translations for the name part of an option. Translations are optional and separated through the ':' character. Supported translations are:

* de - German language
* en - English language
* fr - French language

The following data source option definitions are supported:

**ID-only**

* Definition: \<ID>\[;\<ID>]
* Example: id1;id2;id3
* Only IDs with no names are shown
* ID and name are the same
* ID is saved as the field value

**ID-Name**

* Definition: \<ID>:\<Name>\[;\<ID>:\<Name>]
* Example: id1:name1;id2:name2;id3:name3
* Names are shown
* ID and name are separated
* ID is saved as the field value

**ID-Name-Translations**

* Definition: \<ID>:\<Name>\[:\<Language>:\<Translation>]\[;\<ID>:\<Name>\[:\<Language>:\<Translation>]]
* Translation for the language of the current user\
  or name if no translation found is shown
* ID, name, language and translation are separated
* ID is saved as the field value

Sample image above shows Data Source Type Option with sample of manually entered dummy options in two languages.&#x20;

## Mapping Attributes&#x20;

Field data is stored as table columns in the database. The Mapping section defines how the fields are identified and used on a database level by the platform and your application.

![Mapping attributes for a field](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBInsEDOZIe2agGLSOR%2F-MBIv8Gv3DJxHcnMJbX1%2Fimage.png?alt=media\&token=044a3175-7f4a-47cd-9687-38a51b527172)

### Key

The mapping key defines the exact name of the column that is saved in the database.

{% hint style="info" %}
The **Key** field is compulsory when creating a field.
{% endhint %}

### Data type

The mapping data type specifies the database data type for this field. Below is a table relating some field common data types with their corresponding database mapping data types.

| Common Data Type | Mapping Data Type |
| ---------------- | ----------------- |
| Guid             | uniqueidentifier  |
| Boolean          | bit               |
| String           | nvarchar          |
| DateTime         | datetime          |
| Integer          | integer           |
| Byte             | tinyint           |
| Short            | smallint          |
| Long             | bigint            |
| Float            | float             |
| Double           | float             |
| Numeric          | decimal           |
| ByteArray        | binary            |
| Char             | char              |
| Xml              | xml               |

{% hint style="info" %}
For additional information on the mapping data types, click on [this link](https://docs.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql?view=sql-server-2017).
{% endhint %}

### Length

Mapping length defines the maximum length of a field.

{% hint style="info" %}
Default value for length is -1. This defines the length as unlimited.
{% endhint %}

### Is Identity

This checkbox determines whether the current field is a primary key in the database or not.

### Is Nullable

This checkbox defines whether this field can have a **null** value in the database.

## Advanced Attributes

The Advanced section allows you to control how the platform and the application uses the field.

{% hint style="danger" %}
Advanced configurations are changed only in unique cases. During normal use, these configurations are already done by the system and should not be changed.
{% endhint %}

![Advanced attributes for a field](https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M8HTRblOKav_qm4KEx6%2F-MBInsEDOZIe2agGLSOR%2F-MBIvW1bxy4trZMeN47r%2Fimage.png?alt=media\&token=57d41330-7305-43d4-9612-acb0b74d4e4f)

### Quick Search Field

Defines whether a field should be shown when using the Quick Search functionality on the platform.

### Include Data Source in Quick Search

This field option is only available if the field has a class as a data source.

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2Ft596CHyu37aUmV8Y9100%2FClassDesigner_DataSourceClass_IncludeDataSourceInQuickSearch.png?alt=media&#x26;token=411cb0fe-d897-4b46-b561-bd10fcb1695c" alt=""><figcaption><p>Include Data Source in Quick Search Option</p></figcaption></figure>

Enabling it, the name field of the class of the data source is included in a quick search or ad hoc query.

### Kind

The platform currently supports two types of fields.

**Real**: A real field has a corresponding entry in the database.\
**Virtual**: A virtual field does not exist in the database. It is instead used to display results calculated or derived from other values.

### Is Required

Defines if the field needs to have a value when a new instance of that class is created.

### Is Read Only

Defines whether the field can be edited.

{% hint style="success" %}
Example: If a field is a unique identifier or a primary key, it may be marked as **Read Only** to prevent users from modifying it.
{% endhint %}

### Is Invisible

This setting defines whether the field is visible in your application.

{% hint style="success" %}
This is especially useful in cases where the user does not need to see or interact directly with a field in the application while the field is still useful in other use-cases (e.g. generating statistics).
{% endhint %}

### Exclude from number formatting

With this option fields with a number data type (Integer, Byte, Short, Long, Float, Double, Numeric) can be configured to be excluded from being formatted.

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2FLSn6GJeXfG646YQGmWzW%2FClassField_ExcludeFromNumberFormatting.png?alt=media&#x26;token=8e11fef6-9f10-4adb-9ae4-9425f35473d2" alt=""><figcaption><p>Sample number Field with the Option</p></figcaption></figure>

If a field is excluded from being formatted, when the value of the field is displayed or modified, then the default format of the chosen language without group separators is used.

For example, you can see below a Double data type field which is formatted (left box) and which is excluded from number formatting by this option (right box).

<div><figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2FsiNxt55KJJu9FNnzCcAv%2FClassField_SampleNotExcludedFromNumberFormatting.png?alt=media&#x26;token=f13cb365-6f8a-48f8-87ad-859c9f8d6b9d" alt=""><figcaption><p>Formatted</p></figcaption></figure> <figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2F1CERqjV9kxf08DV3meVP%2FClassField_SampleExcludedFromNumberFormatting.png?alt=media&#x26;token=05ac6316-4e18-4780-b0d2-53bb01b36faf" alt=""><figcaption><p>Excluded from Formatting</p></figcaption></figure></div>

### Default Mode

The default mode defines for the field kind Real or Language at what point should a field be saved to the database.&#x20;

* **None**\
  The [default expression](#default-expression) will not be used.<br>
* **Creation** \
  The field is saved when the class object is created.<br>
* **Insertion**\
  The field is saved when the class object is saved.

### Default Expression

This configuration allows you to generate a default value for a field when an object of the class is created.

{% hint style="success" %}
This is particularly useful when the field value is being automatically generated via a method.
{% endhint %}

### Virtual Field

#### Get Expression Type

For the Virtual field kind it is possible to choose between two expression types:

* Expression
* Script

As the name implies, for the type Expression it is possible to write an expression and for the type Script it is possible to write a script with the [Script Designer](https://docs.tivity.one/building-an-application/execution/scripting) to provide the value of the virtual field.

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2FS1c2gxNJtvbaQ0T3fP7P%2FVirtual%20field%20kind%20expression%20types.gif?alt=media&#x26;token=990ee8b8-30cf-4c12-aa6b-179007bcf26d" alt=""><figcaption><p>Virtual Field Expression Types</p></figcaption></figure>

#### Get Expression

Option for the expression type Expression to write an expression to provide a value for the field kind Virtual.

#### Create and open expression script

Option for expression type Script to write a script with the [Script Designer](https://docs.tivity.one/building-an-application/execution/scripting) which provides the value for the field kind Virtual.

### Store

In the Store section of the Advanced options it is possible to set an expression or write a script which are set during the field saving process.

#### Get Expression Type

Two expression types are available:

* Expression
* Script

<figure><img src="https://2608258621-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8HTRblOKav_qm4KEx6-887967055%2Fuploads%2F7iRR3mD44DBoxJInuQ9V%2FClass%20field%20Store.gif?alt=media&#x26;token=6ee16289-0e2c-4bf6-9452-29d5ff2040b6" alt=""><figcaption><p>Store Expression Types</p></figcaption></figure>

#### Get Expression

Option for the expression type Expression to write an expression to provide a store value.

#### Create and open expression script

Option for expression type Script to write a script with the [Script Designer](https://docs.tivity.one/building-an-application/execution/scripting) which provides the store value.

## Permissions

This section deals with specific read and write permissions of the field for single users or user groups.

{% hint style="info" %}
More information about permissions can be found in the Rights Designer.
{% endhint %}
