How to create a hidden column in an InfoPath repeating table
Step-by-step instructions describing two ways to hide a column in a repeating table in InfoPath.
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:
- Add a Repeating Table control to the InfoPath form template and then delete the column you want to hide.
- 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 achieve this functionality as follows:
- In InfoPath 2007, create a new Blank form template.
- On the Controls task pane, click Repeating Table to add a repeating table to the InfoPath form template.
- On the Insert Repeating Table dialog box, click OK to accept the default of adding 3 columns to the repeating table.
- Click in the header of the second column of the repeating table to place the cursor.
- 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.
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:
- In InfoPath 2007, create a new Blank form template.
- On the Controls task pane, click Repeating Table to add a repeating table to the InfoPath form template.
- 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.
- On the Data Source task pane, right-click the group2 node, and select Add from the drop-down menu that appears.
- 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.
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:
