How to create a hidden column in an InfoPath repeating table

Applies to: InfoPath 2007

Step-by-step instructions describing two ways to hide a column in a repeating table in InfoPath.

ADVERTISEMENTS

I've previously written about using and creating hidden fields in InfoPath. In essence, a hidden field in InfoPath is a field that exists in the Main data source of the InfoPath form template, but not on any Views of the form.

A hidden column in a repeating table in InfoPath is useful, for example if you want to apply a formula to each row in the repeating table, but you don't want users to see the field in which the formula is being used.

You can add a hidden column to a repeating table in InfoPath in one of 2 ways:

  1. Add a Repeating Table control to the InfoPath form template and then delete the column you want to hide.
  2. Add a hidden field to the repeating table via the Data Source task pane after you've added a Repeating Table control to the InfoPath form template.

Add a repeating table and then delete the column to be hidden

You can create a hidden field in an InfoPath repeating table as follows:

  1. In InfoPath 2007, create a new Blank form template.
  2. On the Controls task pane, click Repeating Table to add a repeating table to the InfoPath form template.
  3. On the Insert Repeating Table dialog box, click OK to accept the default of adding 3 columns to the repeating table.
  4. Click in the header of the second column of the repeating table to place the cursor.
  5. On the Table menu, select Delete, and then click Columns.

The repeating table on the InfoPath form View should now contain 2 visible columns, while the repeating node for the repeating table in the Main data source of the InfoPath form template still contains 3 nodes, and thus making all of the field2 fields in the repeating table hidden.

Repeating table with 2 visible columns and 1 hidden column on an InfoPath form View and 3 fields in the Main data source.
Figure 1. Repeating table with 2 visible columns and 1 hidden column on an InfoPath form View and 3 fields in the Main data source.

Add a repeating table and then add a hidden field

You can achieve this functionality as follows:

  1. In InfoPath 2007, create a new Blank form template.
  2. On the Controls task pane, click Repeating Table to add a repeating table to the InfoPath form template.
  3. On the Insert Repeating Table dialog box, type 2 in the Number of columns text box, and click OK to add 2 columns to the repeating table.
  4. On the Data Source task pane, right-click the group2 node, and select Add from the drop-down menu that appears.
  5. On the Add Field or Group dialog box, type a Name (for example hiddenField) for the field, and click OK.

The repeating table on the InfoPath form View should now contain 2 visible columns, while the repeating node for the repeating table in the Main data source of the InfoPath form template contains 3 nodes, and thus making all of the hiddenField fields in the repeating table hidden.

Repeating table with 2 visible columns and 1 hidden column on an InfoPath form View and 3 fields in the Main data source.
Figure 2. Repeating table with 2 visible columns and 1 hidden column on an InfoPath form View and 3 fields in the Main data source.

 


Related InfoPath Articles:

 

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

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