# 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](/pim3/tutorials/helpful-guides/how-to-use-import.md)\
\
The tools this tutorial goes through are all found on the data mapping page of import
{% endhint %}

## Validation rules

When importing Text [attributes](/pim3/fundamental-concepts/attributes.md) 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="/files/LjNx4jHUQjF7xMlb08sF" 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](/pim3/fundamental-concepts/attributes.md).&#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](/pim3/fundamental-concepts/attributes.md) 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="/files/ia4TwSJs7mvM0uavMgnd" 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="/files/3DTs2trrTkO4LvyQWoR4" alt=""><figcaption><p>Left: Warning, Right: Error</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.struct.com/pim3/tutorials/helpful-guides/how-to-use-import/how-to-use-validation-rules-during-import.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
