Applies ToInfoPath 2010 InfoPath 2013

In this article

Overview

Repeating tables and repeating sections frequently contain numeric values that you want to add at the bottom of the section. For example, you might have a repeating table that contains order information, which includes the extended prices of each item. At the bottom of the table, you can display a grand total, as shown in the following illustration.

This article describes how to add values in one or more columns of a repeating table or section.

Add one column of values in a repeating table or repeating section

If you are adding a column in a repeating table, you can place the control that calculates the total outside the table, or you can place it in the footer of the table, as shown in the previous illustration. To achieve this result, if the footer is not already displayed, follow these steps to display the footer in the repeating table.

  1. In design mode, right-click the header row of the repeating table, and then click Repeating Table Properties.

  2. Click the Display tab.

  3. Select the Include footer check box, and then click OK.

If you only want to display the results of the calculation, and you do not want to use the results of the calculation in other calculations, use an expression box to perform the calculation. An expression box only displays data; it does not save it in the form. If you want to use the results of the calculation in another calculation, use a text box.

Use an expression box to add a column of values

  1. Click where you want to insert the expression box.

  2. On the Insert menu, click More Controls.

  3. In the Controls task pane, under Advanced, click Expression Box.

  4. In the Insert Expression Box dialog box, click Edit Formula next to the XPath box.

  5. In the Insert Formula dialog box, click Insert Function.

  6. In the Categories list, in the Insert Function dialog box, click Math.

  7. In the Functions list, click sum, and then click OK.

  8. In the Formula box, in the Insert Formula dialog box, double-click the text in parentheses.

  9. In the Data source list, in the Select a Field or Group dialog box, click the field whose values you want to add. The field must be bound to the column and it must be a repeating field or part of a repeating group.

  10. Click OK two times.

Use a text box to add a column of values

  1. Click where you want to insert the text box.

  2. On the Insert menu, click Text Box.

  3. Double-click the text box that you just added.

  4. Click the Data tab.

  5. Under Default Value, click Edit Formula .

  6. In the Insert Formula dialog box, click Insert Function.

  7. In the Categories list in the Insert Function dialog box, click Math.

  8. In the Functions list, click sum, and then click OK.

  9. In the Formula box in the Insert Formula dialog box, double-click the text in parentheses.

  10. In the Data source list in the Select a Field or Group dialog box, click the field whose values you want to add. The field must be bound to the column and it must be a repeating field or part of a repeating group.

Top of Page

Add two or more columns of values in a repeating table or repeating section

Suppose that you have more than one column that you want to add together. In InfoPath, you can use the union operator (|) to accomplish this, regardless of whether the columns are contained in a single repeating table or repeating section, or if they are spread across several repeating tables or sections. For example, you might have one repeating table that contains order information, and another repeating table that contains back-ordered items. You can use this procedure to add a control to the form that adds the total order amount across the two tables.

If you only want to display the results of the calculation, and you do not want to use the results of the calculation in other calculations, use an expression box to perform the calculation. An expression box only displays data and does not store it. If you want to use the results of the calculation in another calculation, use a text box.

Use an expression box to add two or more columns

  1. Click where you want to insert the expression box.

  2. On the Insert menu, click More Controls.

  3. In the Controls task pane, under Advanced, click Expression Box.

  4. In the Insert Expression Box dialog box, click Edit Formula next to the XPath box.

  5. In the Insert Formula dialog box, click Insert Function.

  6. In the Categories list, in the Insert Function dialog box, click Math.

  7. In the Functions list, click sum, and then click OK.

  8. In the Formula box, in the Insert Formula dialog box, double-click the text in parentheses.

  9. In the Data source list in the Select a Field or Group dialog box, double-click the first field whose values you want to add.

  10. In the Formula box, type the union operator (|) immediately after the field you just inserted.

  11. Click Insert Field or Group.

  12. In the Data source list, in the Select a Field or Group dialog box, double-click the next field whose values you want to add. The field must be bound to the column and it must be a repeating field or part of a repeating group. The formula should resemble this:

sum(field16 | field17)

  1. Repeat steps 10 through 12 for any additional columns that you want to add.

Use a text box to add two or more columns

  1. Click where you want to insert the text box.

  2. On the Insert menu, click Text Box.

  3. Double-click the text box that you just added.

  4. Click the Data tab.

  5. Under Default Value, click Edit Formula .

  6. In the Insert Formula dialog box, click Insert Function.

  7. In the Categories list, in the Insert Function dialog box, click Math.

  8. In the Functions list, click sum, and then click OK.

  9. In the Formula box, in the Insert Formula dialog box, double-click the text in parentheses.

  10. In the Data source list in the Select a Field or Group dialog box, double-click the first field whose values you want to add. The field must be bound to the column and it must be a repeating field or part of a repeating group.

  11. In the Formula box, type the union operator (|) immediately after the field you just inserted.

  12. Click Insert Field or Group.

  13. In the Data source list, in the Select a Field or Group dialog box, double-click the next field whose values you want to add. The field must be bound to the column and it must be a repeating field or part of a repeating group. The formula should resemble this:

sum(field16 | field17)

  1. Repeat steps 10 through 12 for any additional columns that you want to add.

Top of Page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.