Learn more about SQL Server tools

mssqltips logo

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Scripts          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories


Setting Row Limits on InfoPath Repeating Tables

By:   |   Updated: 2010-11-26   |   Comments   |   Related: > Sharepoint


In InfoPath Forms, one of the repeating controls is the repeating table. The repeating table can be used to facilitate entering multiple records in a structured tabular format.

One of the common problems with this control is that InfoPath doesn't provide any kind of out of box approach to set minimum or maximum limit of repeating table.

Let's explore some a solution...


Consider a scenario, where a form contains basic employee information of a particular business unit. And the business requirement is that the form should enforce at least 3 employees and at most 5 employees with basic details like their name, age and department.

InfoPath has a schema file as one of the source files. Using a schema file, we can configure the minimum and maximum capacity of rows in a repeating table.

Below in the image, you can see a sample form with "EmpInformation" as its repeating group name of EmpName, EmpAge and EmpDepartment.

employee information

Now to generate schema file, click on File -> Save as Source Files and save it into a folder. Open the same folder.

source files

After opening the folder, you can see our desired file (which is most probably) named as "myschema". Open the file in notepad and it would look similar to below image.


In order to implement our requirement, we need to change the section highlighted in above image, to minOccurs="3" maxOccurs="5".


Now save the file and close it. Right click on the "manifest" file and click design. At this point you still will not be able to see the changes. Then, click on "Preview" form and you would be able to see three rows when the form loads. It is because we set the group minimum occurrences to three.

employee information

One of the issues with this approach is that when you try to keep rows less than what is required or more than the maximum limit, InfoPath will internally throw an error.

employee information

One of the ways this can be addressed is by using conditional formatting to disable insert or deletion of rows.

Next Steps
  • Use this approach to define the limits of repeating information in the InfoPath forms.

Last Updated: 2010-11-26

get scripts

next tip button

About the author
MSSQLTips author Siddharth Mehta Siddharth Mehta is an Associate Manager with Accenture in the Avanade Division focusing on Business Intelligence.

View all my tips

Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 

Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.


Learn more about SQL Server tools