Min vs. Max
- For a given schema, the Min occurs value should always be less than Max Occurs value.
- The default values for these 2 properties are “1”, which means if we won’t specify the values, then the field is mandatory. So please don’t ignore these properties and always set the Min Occurs value to “0”, if the field is not mandatory.
- If the maximum no of occurrences of the field is not known, then set the Max Occurs property to “unbounded” or “*” (This also applies for Group Max Occurs and Group Min Occurs)
Group Max Occurs vs. Max Occurs
As the name implies the ‘Max Occurs’ informs us the maximum occurrences of a particular field and the ‘Group Max Occurs’ informs us the maximum occurrences of a group of fields irrespective of the Group Order Type property value.
Here the Group can be of any type. It can be either “Sequence “or “Choice”. (This also applies for Min occurs). It means if the Group Max property is 5 for a group, then the group can appear for a max of 5 times but not more than that.
The node structure will be like this.
<Child>First Instance</ Child >
< Child >Second Instance </ Child >
< Child >Third Instance </ Child >
< Child >Fourth Instance </ Child >
< Child> Fifth Instance </ Child >
Note: It’s the Group Max property of “Parent” element but not “Child”. Because I have seen people thinking it’s for “Child” node as “Child” is getting repeated but not the “Parent”.
The Group properties will be disabled for the Records which don’t have any sub records.
A point to note down here is that if we add a Sequence/Choice group directly (instead of setting the Group Order property to “Sequence”/”Choice”), the Group properties will be disabled.
Here the Record111 does not have any sub fields. So automatically the Group properties are disabled.
Here you can see that the Group Max/ Min Properties are not applicable for Sequence. Similar is the case for Choice.