Documentation Center

Configuring a minimum or maximum number of values for a field

The Design tab of a Schema lets you specify if a field can have a single value or multiple values. But by editing the Schema source, you can also specify a minimum and/or maximum allowed number of values.

Procedure

  1. In a Schema dialog, access the Source tab.

    You see XML containing a number of xsd:element elements with a name attribute set to the XML name of one of your field, and attributes minOccurs and maxOccurs set to one of the following values:

    • minOccurs is set to 0 (optional field) or 1 (mandatory field).
    • maxOccurs is set to 1 (single-value field) or unbounded (multivalue field).
  2. To enforce a minimum number of values (other than 1) for a field, set the minOccurs attribute of its element to that number.
  3. To enforce a maximum number of values (other than 1) for a field, set the maxOccurs attribute of its element to that number.
  4. Save and close the Schema.

Results

Items based on this Schema now can only be saved if the field has at least the amount of values specified in minOccurs, and no more values than specified in maxOccurs. For example, a Component link field with its minOccurs set to 3 and its maxOccurs set to 5 means that an item based on this Schema can only be saved if it contains 3, 4 or 5 Component links.

Note that the Schema's Design tab does not show Allow multiple values as selected for this field, even though the field does allow multiple values. Also, any change to the field sets the minimum and maximum values back to their original values.