BizTalk: Group Max Occurs vs Max Occurs in Schema
Group Max Occurs:
Specifies us the maximum occurrences of a group of fields irrespective of the Group Order Type property value.
Max Occurs:
Specifies the maximum number of times that the element or record corresponding node can occur.
Group Order Type:
If Group Order Type is "Sequence" then all below child node repeat in same order as defined in xsd file and if Group Order Type is "All" then all child node repeat without in sequence but all child node must be available and if Group Order is "Choice" then all child node is not mandatory in repeating node.
Note: Default value of Group Max Occurs, Max Occurs, Group Min Occurs and Min Occurs is "1" and also Group Min Occurs and Min Occurs is not less than Group Max Occurs and Max Occurs respectively. Please follow below very simple example to verify your doubt.
1. Firstly see below image and create same schema in your visual studio
2. Now click on Solution Explorer and Right click same schema that already created from list and Generate Instance and copy yellow records two more time as shown in below picture.
3. Click on child record "AHDetails" and go to property of same record node set Max Occurs as "unbounded" or "*". Now browse same XML file in the Input Instance Filename from the same xsd file property.
4. Click Validate Instance from the list of same xsd file and see the below result as showing in following image.
5. Keep same Input Instance Filename and change "AHDetails" property from Max Occurs to Group Max Occurs as "unbounded" or "*". Now Right click xsd file property and click on Validate Instance then see the below error as showing in below picture because I have change Group Max Occurs as "unbounded" and Default Group Order Type is "Sequence" so all below child element repeat in same order in same Record name "AHDetails" but my xml file there are multiple time "AhDetails" tags.
6. Do not change "AHDetails" property i.e. Group Max Occurs is "unbounded" and browse another XML file in Input Instance Filename as showing in following picture i.e. there is yellow Record node "AHDetails" is one time but multiple time repeat there child element.
7. Again go to solution explorer list and right click on same xsd file property then click Validate Instance and see the below following successfully validated result.
8. See the below another XML file, there are multiple record node "AHDetails" and also Name elements
9. To Validate Instance of above XML file, Click "AHDetails" node then go to their property and set Max Occurs value as "unbounded" and also same "unbounded" value for "Name" element as showing in below picture and finally click Validate Instance from same xsd file property then see the following successfully result.
10. Create one more XML file as showing below picture
11. In above image there is only one "AHDetails" record note but multiple "Name" element so Validate Instance as successfully, Please set value as "unbounded" of "AHDetails" Group Max Occurs and same "Name" element property.
For Group Min Occurs and Min Occurs, same procedure applies.