In the previous example, fractional values can be entered in the units field. If a units value such as 2.3333 were entered, the value calculated for the amount field will probably contain extra decimal places. The round function rounds money values to basic currency units (two decimal places for the U.S.), and rounds real values to zero decimal places. Figure 2 shows how the round function is used to eliminate extra decimal places from the amount field.
Form Name ex2
Data File
Beginning form no Unique records no
Repeating form no Appended form no
Freeze form no Additional form no
Required form no for one record
Next form name ex2
Field name units Field length 8
Entry Allowed yes Input required no
In Data File no Invisible no
Edit Data Type real
Field name each Field length 12
Entry Allowed yes Input required no
In Data File no Invisible no
Edit Data Type money
Field name amount Field length 14
Entry Allowed no Input required no
In Data File no Invisible no
Calculation round (units * each)
Edit Data Type money
Figure 2
The amount field contains the expression
round (units * each)
The amount field will always contain exactly 2 decimal places (with the default formatting set), regardless of the values in the units or each fields.
Note also that the expression entered into the Copy/Calculate field has several blanks in it. Blanks may be entered between different elements of the expression to make it more readable.