How to pre-fill a repeating table in InfoPath with rows of data

Learn how you can add default rows to a repeating table in InfoPath, so that when you open the form, the repeating table already contains a certain amount of rows with data.

ADVERTISEMENTS

Problem

You want a repeating table on an InfoPath form to contain a predetermined amount of rows of data when you open the InfoPath form.

Solution

Use the Default Values option to prefill the repeating table with a certain amount of rows of data.

Discussion

You can achieve this functionality as follows:

  1. In InfoPath, create a new Blank form template.
  2. On the Insert menu, click Repeating Table.
  3. On the Insert Repeating Table dialog box, enter the number of columns for the repeating table or accept the default of 3 columns, and click OK.
  4. On the Tools menu, click Default Values.
  5. On the Edit Default Values dialog box, expand the group1 node.
  6. On the Edit Default Values dialog box, click the group2 node to select it, click the arrow to the right of the node to display the drop-down menu, and then click Add another group2 below.

    Adding a row to a repeating table on the Edit Default Values dialog box in InfoPath
    Figure 1. Adding a row to a repeating table on the Edit Default Values dialog box in InfoPath.

  7. Repeat the previous step for as many default rows as you want to add to the repeating table.
  8. Once you're done adding the default rows, click the field1 node under the first group2 node to select it, and enter the data that you want the this field (located in the first column of the first row of the repeating table) to contain in the Default Value text box at the bottom of the Edit Default Values dialog box.

    Prefilling the field located in the first column of the first row of the repeating table in InfoPath
    Figure 2. Prefilling a default value for the field located in the first column of the first row of the repeating table in InfoPath.

  9. Repeat the previous step for each field in each row of the repeating table, which you want to prefill with data.
  10. Once you're done entering the data for the fields, click OK on the Edit Default Values dialog box.

You should now have a fully functional InfoPath form, so that when you open the form, the repeating table has already been prefilled with rows of data.

 
 Subscribe for updates via RSS or Email

Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners
InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013
InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners
InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010
InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers
InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services


Related InfoPath Articles:

ADVERTISEMENTS

InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services