InfoPath – Limit the number of items in repeating table

14 באפריל 2010

תגיות: , ,
13 תגובות

Credit for this cool trick goes to Ziv Cohen (from BSP)who found and showed it to me.

If you want to limit the number of items in a repeating table, there no apparent way in the UI to do it. Here’s a quick way to do it without writing code.

  1. On a form with a repeating table. Pay attention to the Group that the Repeating table is bound to.
  2. Get the source files of the form. (in 2007: File –> Save as source files. in 2010: File->Publish->Export Source Files)
  3. Close InfoPath.
  4. Open the schema file. It’s the file with XSD extension.
  5. Find the part representing the Group of the Repeating table (from step 1), and it’s sequence in it’s parent group.
  6. The group should have an attribute called “maxOccurs”
  7. This is what we’re looking for, set your limit here. (any number)
  8. Open the modified form in InfoPath (the easiest way is right click on manifest.xsf and click “Design”)
  9. Continue your editing… When you’re done just save the file as normal XSN, and you can dump the source files.

When you fill out the form, you won’t be able to fill more items then what you’ve specified in the schema file

This should work for browser forms too.

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. שדות החובה מסומנים *

13 תגובות

  1. Ziv Cohen14 באפריל 2010 ב 9:29

    Thanks for the credit 🙂

  2. Kim Skirvin16 במרץ 2011 ב 17:06

    works great! I'm not a developer but was able to figure it out.

    Thank you.

  3. swamy6 במרץ 2012 ב 9:16

    I am able to do this, but when I am trying to insert row after maximum limit, I am getting Error message popup.

    Can we restrict this?

  4. John johnson19 במרץ 2012 ב 4:50

    Swarmy, you mean you put a maximum limit in your form, and when you get to it, you can't put any more in without an error? Oh no. This fix must be broken.

  5. icons17 בספטמבר 2012 ב 23:53

    It is possible to tell, this exception 🙂

    P.S. Please review Free PNG Icons from yourmailkept

  6. icons18 בספטמבר 2012 ב 2:27

    Thanks, can, I too can help you something?

    P.S. Please review Glossy Data Icons from popavidi3

  7. icons18 בספטמבר 2012 ב 12:28

    In my opinion you commit an error. Let's discuss.

    P.S. Please review Bar Icons for Windows Phone from martinking33

  8. icon downloads18 בספטמבר 2012 ב 15:36

    I congratulate, it seems brilliant idea to me is

    P.S. Please review Hotel App Tab Bar Icons fo… from yourmailkept

  9. Fumen2 באוקטובר 2012 ב 16:42

    Thanks for the fix but I'm wondering if there's a way we could put a better error message. We all know end users aren't that bright; they're going to think the form is broken even though you specified what the maximum is.

  10. Toby5 בדצמבר 2012 ב 14:36

    To avoid an error, you can create a conditional formatting rule for the repeating table to only allow a set number of rows to be inserted.

    Select the repeating table field and add a new formatting rule. Set the condition to count(.) > 6 and check the box "Don't allow users to insert of delete this control". This will limit the number of rows that can be inserted to 6.