Setting Row Limits on InfoPath Repeating Tables

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


Problem

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...

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.

notepad

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

myschema

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.


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



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

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2010-11-26

Comments For This Article

















get free sql tips
agree to terms