7.1. Using Expression Boxes with Formulas

Before you jump into the more complicated controls, there is a control that displays formulas on your InfoPath forms. Besides being able to bind text boxes to fields, as is done when you drag fields from the data source, you can display formulas using a control called an expression box.

Creating a formula to display in an expression box is the same as creating a formula for a default value except that you can use other fields within the formula. You can use formulas in a number of ways. Following are two of the most common:

  • Totaling columns: InfoPath supplies built in functions such as sum(), avg(), and others.

  • Combining the values of multiple fields.

In this section, you get a chance to work with multiple fields.

Once you have added an expression box, you need to specify the formatting of the data being displayed. To do this, you open the property sheet of the expression box control and set the format.

7.1.1.

7.1.1.1. Try It Out: Adding an Expression Box Based on a Formula

Once you open the form called Chapter 7 Intro.xsn in Design mode, you can see, as in Figure 7-1, that there is a column with the title of Item Total. The object of this Try It Out is to add an expression box to display a total for each item.

Figure 7.1. Figure 7-1
  1. Place the cursor in the table cell beneath the Item Total label.

  2. Click on the Controls task in the Design ...

Get Beginning InfoPath™ 2003 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.