Chapter 4. Building the base scenario: Stage 1 87
Figure 4-23 Input Items on wizard page
4.6 Applying formatting and logic
Once you have all the visible items on the form, you can apply formatting, calculations and
logic.
Unlike paper forms, XFDL forms can perform sophisticated checks and calculations while the
user fills out the form. This can prevent mistakes right at the source and provide a high level of
comfort while filling out the form.
4.6.1 Creating a field calculation
In this section we create a field calculation.
88 IBM Workplace Forms: Guide to building and integrating a sample Workplace Forms application
Calculation by decision
In our Sales Quote example we want to add a multiplication calculation to the amount field of
the item based on the quantity and item the user selected from the product list. To accomplish
this, we will use the formula wizard in the Workplace Forms designer by following these steps:
1. Open the Properties window for the first field (FIELD12) in the Total column of the Product
section of the traditional form.
2. Click the Add Formula button in the
Field Contents section on the General tab as seen in
Figure 4-24.
Figure 4-24 Properties box of the Total field
3. Select set by a calculation of two values from the drop-down.
4. In the Formula section, as seen in Figure 4-25:
a. Select value of from the first drop-down; a hand icon will appear, click it.
b. On the form page that is now visible, choose the first field in the quantity column.
c. Select multiplied by in the middle drop-down list.
d. Select value of from the second drop-down; a hand icon will appear, click it.
e. On the form page that is now visible, choose the corresponding price field.
f. Exit the Calculation window by clicking OK, then exit the Properties window by clicking
OK.
Chapter 4. Building the base scenario: Stage 1 89
Figure 4-25 Formula wizard of Field Contents property of the Total field
Sum calculation
As a second example, we want to create a sum field that calculates the total amount of the
products in the sales quote to be approved. To accomplish we follow these steps:
1. Open the Properties window for the Order Total field on the lower right end of the Products
section.
2. Click the Add Formula button in the Field Contents section on the General tab. (See
Figure 4-26.)
Figure 4-26 Properties box of the Order Total field

Get IBM Workplace Forms: Guide to Building and Integrating a Sample Workplace Forms Application 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.