# How to use Validation rules during import

{% hint style="info" %}
**Prerequisite:** This tutorial assumes you know the basics of the import feature. If this is not the case you can learn the basics in other guides here: [How to use import](https://docs.struct.com/pim3/tutorials/helpful-guides/how-to-use-import)\
\
The tools this tutorial goes through are all found on the data mapping page of import
{% endhint %}

## Validation rules

When importing Text [attributes](https://docs.struct.com/pim3/fundamental-concepts/attributes) you can choose to add validation rules on the incoming values.

You can add these validation rules on a column by column basis. If you wish to add a validation rule to a column you can click the 'Validation Rules (0)' text to the right of the data mapping.

<figure><img src="https://3609403033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZJAMIKVcqchSDbt4A7DE%2Fuploads%2F6HKoEfdiwYB6EtgpC8Zc%2Fimage.png?alt=media&#x26;token=62ee1bf5-1436-4296-bf9f-24628e246e36" alt=""><figcaption><p>Data mapping during import</p></figcaption></figure>

Clicking the 'Validation Rules (0)' text will open a new tab. In this tab you can add one or more validation rules to the specified [attribute](https://docs.struct.com/pim3/fundamental-concepts/attributes).&#x20;

Your first choice is the kind of Validation mode you wish to use. You have two choices:

* Error - If validation rule does not hold for a row, it will show in the change cell and the [attribute](https://docs.struct.com/pim3/fundamental-concepts/attributes) will be ignored during import
* Warning - If validation rule does not hold for a row, a warning will be shown in that change cell.

This choice will determine how the system tells you a validation rule does not hold for a row.

<figure><img src="https://3609403033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZJAMIKVcqchSDbt4A7DE%2Fuploads%2FJrqIZGb1LglkMOrGmNAa%2Fimage.png?alt=media&#x26;token=3fd367ef-bee2-4f8d-b3e9-05091ae263ac" alt=""><figcaption><p>Validation rule will warn if incoming text length is not less than 5</p></figcaption></figure>

Next choice is the Validation type you wish to use. Once again you have two choices:

* Textstring length - How many symbols are in the text.
* Regular expression - If a regex pattern matches

Third you choose the condition, the condition will depend on the Validation type.

Having succesfully created a rule you can choose to add another rule to the column or click the green "Update rules"-button in the bottom-left corner.

## Warning & Error

Underneath is shown images of what it looks like if a Validation rule does not hold for warning and error respectively:

<figure><img src="https://3609403033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZJAMIKVcqchSDbt4A7DE%2Fuploads%2FHqtcNajmGeA73rfEuO5h%2Fimage.png?alt=media&#x26;token=fb7532f9-0a36-44a0-b5e2-a02b6e90da70" alt=""><figcaption><p>Left: Warning, Right: Error</p></figcaption></figure>
