# Advanced Validations

## Validations

#### Range

Validates that field's values for `Number` and `Double` columns fall within a `min` and `max` values. Either `min`, `max` or `both` must be defined. Values are inclusive.

<table><thead><tr><th>Name</th><th>Value</th><th data-type="checkbox">Is Required</th></tr></thead><tbody><tr><td><code>validate</code></td><td><code>range</code></td><td>true</td></tr><tr><td><code>min</code></td><td></td><td>false</td></tr><tr><td><code>max</code></td><td></td><td>false</td></tr><tr><td><code>errorMessage</code></td><td></td><td>false</td></tr></tbody></table>

#### Length

Validates that field's value for `String` column falls within `min` and `max` number of characters.

Either `min`, `max` or `both` must be defined. Values are inclusive.

<table><thead><tr><th>Name</th><th>Value</th><th data-type="checkbox">Is Required</th></tr></thead><tbody><tr><td><code>validate</code></td><td><code>length</code></td><td>true</td></tr><tr><td><code>min</code></td><td></td><td>false</td></tr><tr><td><code>max</code></td><td></td><td>false</td></tr><tr><td><code>errorMessage</code></td><td></td><td>false</td></tr></tbody></table>

#### Unique Across Multiple Fields

Validate uniqueness across multiple fields. To use it, place a `unique_with` validation on each field that you want to be part of the uniqueness validation, all sharing the same `uniqueKey`.

<table><thead><tr><th>Name</th><th>Value</th><th data-type="checkbox">Is Required</th></tr></thead><tbody><tr><td><code>validate</code></td><td><code>unique_with</code></td><td>true</td></tr><tr><td><code>uniqueKey</code></td><td></td><td>false</td></tr><tr><td><code>errorMessage</code></td><td></td><td>false</td></tr></tbody></table>

Here is an example set of fields using `unique_with` validations used to validate that the combination of `department code` and `employee Id`   fields are unique.

<pre class="language-json"><code class="lang-json"><strong>[
</strong>  {
    "key": "Department Code",
    "name": "Department Code",
    "type": "String",
    "validations": [
      {
        "validate": "unique_with",
        "uniqueKey": "Employee No"
      }
    ]
  },
  {
    "key": "Employee Id",
    "name": "Employee Id",
    "type": "Number",
    "validations": [
      {
        "validate": "unique_with",
        "uniqueKey": "Employee No"
      }
    ]
  }
]
</code></pre>

Here is the example of `unique_with` validation in action,

<figure><img src="https://3446432046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdcNtx1PbzBQcufHhuySW%2Fuploads%2FL1Y5Udr2QdumlwMaGbW9%2Fimage.png?alt=media&#x26;token=d8519037-0656-4d14-a437-84d6616c50a0" alt=""><figcaption><p>Checking uniqueness of Employee No using unique_with validation</p></figcaption></figure>

## Adding Validations

### From Platform

1. Click on `Validations` while adding column or click on `Edit` to edit the column.<br>

   <figure><img src="https://3446432046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdcNtx1PbzBQcufHhuySW%2Fuploads%2F5vVWdxTnLnxP5p2HH5Bk%2Fimage.png?alt=media&#x26;token=1c51cd8d-4c1f-4122-bffb-128663be108a" alt=""><figcaption><p>Mentioning Validations</p></figcaption></figure>
2. Assign validations as needed,<br>

   <figure><img src="https://3446432046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdcNtx1PbzBQcufHhuySW%2Fuploads%2F0COjhjW7UFlSm3I2WbhL%2Fimage.png?alt=media&#x26;token=6d4cb1e8-1b7a-47f6-b70a-122954dd64b9" alt=""><figcaption><p>Assigning validations from web UI</p></figcaption></figure>

### From Code

You can check the advanced validations sections in react( [#advanced-validations](https://docs.impler.io/importer/react-embed#advanced-validations "mention")), angular [#advanced-validations](https://docs.impler.io/importer/angular-embed#advanced-validations "mention")) and javascript ([#advanced-validations](https://docs.impler.io/importer/html-js-embed#advanced-validations "mention"))

***

If you have any questions, suggestions, or comments. Feel free to reach out to us over [**Discord**](https://discord.impler.io). We’re constantly improving to deliver the best Data Importer for your product, and we value your input.
