# Constraints

This section provides options for limiting input values, setting default values, and configuring field validation.

## **1. Minimum and Maximum**

Here you can specify the minimum and maximum values that can be entered into the columns. Any values outside of this range are not permitted. These limits can be applied to the input types: *Number, Decimal, Date Time,* and *Date*.

Consider the example below, where the minimum and maximum values are set for the 'Salary' column.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FO1qFswlYqqsGHxVRYe1L%2Fimage.png?alt=media&#x26;token=2dc2085c-3bd4-443f-b041-69d46434d442" alt=""><figcaption><p>Minimum and Maximum</p></figcaption></figure>

The existing values remain unchanged. However if a user enters a salary that falls outside the specified range, they will be notified of the minimum and maximum limits.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FPJdvcOaFSnY4t9y2P7Ho%2Fmin%20and%20max-editable.gif?alt=media&#x26;token=3679ca51-df4a-4a6b-80aa-9c742d8e57ec" alt=""><figcaption><p>user notified about the min and max values </p></figcaption></figure>

Note: You can also set any one of these limits (either minimum or maximum).

For *Date* and *DateTime* input types, users may choose a date range or both date and time range. Any date and time outside of this range will not be accepted.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FqzieqpghSODP9aZjtfXp%2Fimage.png?alt=media&#x26;token=095a0d5c-4703-482e-9a59-e53a45e2fec0" alt=""><figcaption><p>Minimum and maximum date range</p></figcaption></figure>

## **2. Field Validation**

This option is available for the Text input type, where you can specify whether to allow only numeric, alphanumeric, non-numeric, Email ID, or URL inputs. You can also specify a regex pattern to allow inputs that match a specific pattern. Inputs that do not match the pattern are flagged and rejected.

This ensures data correctness and accuracy.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2F1BkjQEQUVJ7B41uxsLyQ%2Fimage.png?alt=media&#x26;token=1260f862-8416-4962-a01c-c88afd40e87b" alt=""><figcaption><p>Field Validation</p></figcaption></figure>

The field value is validated against your specified input type configuration. If another type is entered, it is not accepted.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FpqF9PBEmjQrvdzjcX7BP%2Ffieldvalidation.gif?alt=media&#x26;token=042699f1-f73a-4006-b7ee-e08352cd21d8" alt=""><figcaption><p>Example</p></figcaption></figure>

When you choose the 'Regex' option, a new field appears with the link 'Click to configure'.&#x20;

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FI7bnSxAIUdzkiXVRTxoI%2Fimage.png?alt=media&#x26;token=3ef30d8f-aa82-4696-9454-1dea53ba6349" alt=""><figcaption><p>Regex option</p></figcaption></figure>

After clicking the link, a pop-up appears where you can enter the regex pattern to be validated against. Click **Apply** and **Save.** In the example below, we have entered the regex text to validate the email ID or URL entered by the users.&#x20;

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2Fudh6CF5q8Toih2SgPrrF%2Fimage.png?alt=media&#x26;token=dd807751-d7cc-4e97-943b-c11f1099e97d" alt=""><figcaption><p>Regex validation for Email ID column</p></figcaption></figure>

When a user enters an incorrect email address or URL, the below prompt appears, and the input is rejected.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2F1Bh9qU34dDVi61cCsYFt%2Fimage.png?alt=media&#x26;token=8b4f0552-68cc-4264-bfdd-e5877e55a19f" alt=""><figcaption><p>Wrong text input</p></figcaption></figure>

## 3. Default Value

EDITable lets you configure default values for the columns. When a new row is added, the specified column is automatically filled with the default value if you have set one.

To set a default value, click the highlighted option below, beside the required column.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2Fjtx9si0mC6xFdwJ3qCKJ%2Fimage.png?alt=media&#x26;token=56da59e2-be2c-4368-a038-0c0532c17341" alt=""><figcaption><p>Click to configure default date</p></figcaption></figure>

### 3.1. Static value

To set a static value, select **Manual** and enter the value. In the example below, a static value is set as the default date for the 'Start Date' column.&#x20;

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2F1n79UEVO7bAjHPnfo5k7%2Fimage.png?alt=media&#x26;token=ec4870b8-942f-4369-9794-df6f5c2330f1" alt=""><figcaption><p>Setting static default value</p></figcaption></figure>

Whenever a new row is added, this column value is automatically populated by default.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FHtIWl8Gum2AGJbqmmwyZ%2Fimage.png?alt=media&#x26;token=d8c6d8d4-f615-44fc-a896-6cf680d7fc65" alt=""><figcaption><p>Default value is filled automatically</p></figcaption></figure>

#### Reset to default on update

Checking the 'Reset to default on update' option sets the default value for newly inserted rows and disables the column from editing. The existing values are retained, and automatically changed to default only when users edit other values in the specific record. Find below an example where the value changes to the default.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2F1I8o7TlalaPztYkN5bkq%2Freset%20to%20default.gif?alt=media&#x26;token=d0cf3ab5-586d-4476-86cc-5b24c29ddb6a" alt=""><figcaption><p>Reset to default on update</p></figcaption></figure>

For the 'Decimal' input type, you can also specify the default number of decimal digits to be allowed.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FbrQlz8pOel94U7WP5AXQ%2Fimage.png?alt=media&#x26;token=6868b289-136f-4ffa-adaa-b312de4bf262" alt=""><figcaption><p>Decimal input type</p></figcaption></figure>

For the 'Person' input type, you can either use their name or email address as default.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2Fgtu45KMGs8fdPLkDnH20%2Fimage.png?alt=media&#x26;token=8b45f98b-720c-4240-a872-878db3200f9d" alt=""><figcaption><p>Person input type</p></figcaption></figure>

For the 'Single-select' type, you can choose the default value from the list of options you have configured.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FD8FiFzomLLDReAWLZDgM%2Fimage.png?alt=media&#x26;token=488ac42c-923a-430a-924c-22d3b10a49c1" alt=""><figcaption><p>Single-select input type</p></figcaption></figure>

For the 'Check Box' type, the default values are automatically configured with the Boolean values: true and false. You can change these to 1/0 or yes/no, etc., if necessary.

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FZV5gdhIAcYrZWiC46437%2Fimage.png?alt=media&#x26;token=89889db4-e6cd-4831-a5d4-6bade430549e" alt=""><figcaption><p>Checkbox type</p></figcaption></figure>

### 3.2. Derived value

You can set derived values as defaults instead of using static values. These derived values are calculated using configurable formulas.&#x20;

EDITable provides many Excel-like formulas and functions to help you perform these calculations. These values change dynamically as the underlying reference data changes.

Derived values can be set for the field types - **Number, Decimal, Text, Date, DateTime, Person, and Email.**

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FdFFkNalZqO0hx6zuloMC%2Fimage.png?alt=media&#x26;token=878c32e3-62c1-4b95-bd80-a055bb654433" alt=""><figcaption><p>Configure derived value</p></figcaption></figure>

#### Recalculate data on update

Checking the 'Recalculate data on update' option sets the calculated value as default for newly inserted rows and disables the column from editing. The existing values are retained and automatically changed to the derived value only when users edit other values in the specific record.&#x20;

<figure><img src="https://608526116-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdpYgiTFFEktmDlcxUGTv%2Fuploads%2FDyTBLf7rc7T8TB5eoAgA%2Frecalculate%20on%20update.gif?alt=media&#x26;token=4d5c4736-6716-4295-a434-1344014423b7" alt=""><figcaption><p>Recalculate data on update</p></figcaption></figure>

We have discussed setting constraints and defaults for table data. In the next section, we will explore how to select and look up values from a table or visual for a single-select field type.
