An [[Invantive Studio/Repository/Concepts/Attribute Rule|attribute rule]] that refuses invalid data is written as follows:
- Open the table in the tree and select its folder "Attribute Rules".
- Choose [[Invantive Studio/Ribbon/Add|"Add"]].
- Enter the "Code" of the rule, choose the "Event Category", such as `M` for insert and update, and choose `E` as "Action Category".
- Write the condition the row must meet in "Constraint Specification", such as `:new.date_end is null or :new.date_end >= :new.date_start`.
- Write the "User Message" as a resource code, with up to five message parameters.
- Switch "Create" on and choose [[Invantive Studio/Ribbon/Save|"Save"]].
The rule takes effect after the next [[Invantive Studio/Repository/Concepts/Generation of the Business Layer|generation of the business layer]].