> For the complete documentation index, see [llms.txt](https://docs.ngsurvey.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ngsurvey.com/de/projects/import-export/xlsform/umfrageblatt/einschrankung.md).

# Einschränkung

Die Spalte constraint wird verwendet, um die Benutzereingabe zu validieren. Sie verhindert, dass der Benutzer fortfährt, bis die Antwort eine von Ihnen definierte Bedingung erfüllt.

Wenn die Antwort die Einschränkung nicht erfüllt, wird eine Nachricht angezeigt, die in `constraint_message` definiert ist.

## 📝 Wie Constraints funktionieren

Der Wert der Frage wird durch einen Punkt (`.`) dargestellt, was „die aktuelle Antwort“ bedeutet. Sie erstellen einen logischen Ausdruck unter Verwendung dieses Werts.

Constraints werden häufig verwendet, um:

* Numerische Bereiche festzulegen (z. B. muss das Alter zwischen 0 und 120 liegen)
* Bestimmte Formate zu erzwingen (z. B. Postleitzahlen, E‑Mails)
* Abhängigkeiten durchzusetzen (z. B. Enddatum nach Startdatum)

| Typ     | name   | label          | constraint                         | constraint\_message                          |
| ------- | ------ | -------------- | ---------------------------------- | -------------------------------------------- |
| integer | age    | Ihr Alter      | . >= 18 and . <= 99                | Das Alter muss zwischen 18 und 99 liegen     |
| text    | zip    | Postleitzahl   | regex(., '^\d{5}$')                | Geben Sie eine 5‑stellige Postleitzahl ein   |
| text    | E-Mail | E‑Mail‑Adresse | regex(., '^\[^@]+@\[^@]+.\[^@]+$') | Geben Sie eine gültige E‑Mail‑Adresse ein    |
| date    | end    | Enddatum       | . >= ${start}                      | Das Enddatum muss nach dem Startdatum liegen |

## ☑️ Verwendung des Punktes (.) in constraint

Der Punkt `.` steht für den vom Benutzer für die aktuelle Frage eingegebenen Wert. Verwenden Sie ihn innerhalb von Funktionen und Ausdrücken:

* `. >= 0` — gültig, wenn der Wert 0 oder größer ist
* `regex(., '^\d{5}$')` — gültig, wenn er dem Muster entspricht

## 🔠 Variablenverweise

Sie können `${question_name}` verwenden, um Antworten aus anderen Fragen im Formular zu referenzieren. Stellen Sie sicher, dass referenzierte Fragen früher im Formular erscheinen.

Beispiel:

* `. > ${min_age}` — stellt sicher, dass die aktuelle Eingabe größer ist als ein zuvor eingegebener Wert

## 🔢 Operatoren und Funktionen für Constraints

Wie bei Relevance können Sie verwenden:

\=, !=, >, <, >=, <= and, or, not()

| Funktion        | Beschreibung                            | Beispiel                                    |
| --------------- | --------------------------------------- | ------------------------------------------- |
| regex()         | Validiert das Format einer Texteingabe  | `regex(., '^\d{5}$')` für US‑Postleitzahlen |
| string-length() | Überprüft die Anzahl der Zeichen        | `string-length(.) <= 50`                    |
| selected()      | Prüft, ob eine Auswahl getroffen wurde  | `selected(${choices}, 'option1')`           |
| today()         | Gibt das aktuelle Datum zurück          | `. <= today()`                              |
| now()           | Gibt aktuelles Datum und Uhrzeit zurück | `. <= now()`                                |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.ngsurvey.com/de/projects/import-export/xlsform/umfrageblatt/einschrankung.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
