Heads up! These docs are for Portofino 3, which is a legacy product. Check out Portofino 4!

Copyright 2008-2012 ManyDesigns srl. All rights reserved.

Purpose

Constraints help you avoid that invalid data be entered in the system. Suppose you want to make sure that a string has exactly 10 characters long or that is conforms to a predefined format. Suppose that you want that a certain "expense" attribute is greater than zero and smaller than another attribute called "budget". These and many other scenarios are possible with constraints.

You, as a modeler, define the rules of the constraints. The system then enforces those rules with all the data that the users enter. If a user enters data that break a constraint, the system interrupts the operation and prompts the user with a meaningful message.


Details

A constraint is a special kind of calculated attribute. To define a constraint you need to:

  • create a boolean attribute
  • define a formula on the attribute
  • marked the formula with the "constraint" flag and specify an error message.

Based on these instructions, the system will:

  • apply the formula, like for any calculated attribute;
  • if an operation (any create, update, or delete operation at the downstairs level) causes the formula to evaluate to true, execute the operation normally;
  • if an operation causes the formula to evaluate to false, stop the operation and prompt the user with the specified error message.

In essence, a constraint is a calculated boolean attribute that must always evaluate to true.


Visibility

You will generally prefer to hide constraint attributes as an implementation detail without exposing them to regular users. To hide them, make sure their in namein summary, and in details flags are unchecked.


 


Previous: Calculated attributes

Next: Advanced workflows