Formatting and rounding calculations

<< Click to Display Table of Contents >>

Formatting and rounding calculations

Not only can you enter new calculations and and edit existing calculations via the ribbon command Mailings | Fields dropdown_arrow | Calculation (see Inserting calculations), but you can also specify the format of a calculation.

You can specify the format immediately when inserting a new calculation or change it at any time by selecting the calculation and choosing the ribbon command Mailings | Fields dropdown_arrow | Calculation.

The following options in the dialog box determine the format of the calculation:

Thousands separator

If you enable this option, numbers as of 1000 are represented with thousands separators. For example, 1230000 is displayed as 1,230,000.

Hide result

If you selected this option, the result of the calculation will not be visible in the text. This makes sense if, for example, you want to perform intermediate calculations with variables and do not want to show the results.
Note: To make a hidden calculation visible again, open the dialog box via the ribbon command File | Properties, switch to the View tab and enable the option Display field names (alternatively: the ribbon command Mailings | group Fields | Field names). You can now select the calculation again, choose the ribbon command Mailings | Field dropdown_arrow | Calculation and disable the option Hide result again.

Decimals

With the default setting Floating, as many decimal places are shown as are required to fully represent the result of the calculation. Alternatively, you can select the option Fixed and specify a fixed number of decimal places to be shown. For monetary amounts, for example, the number of decimal places should be fixed at 2.
Note: The value is not actually rounded by setting a fixed number of decimal places; only its representation is rounded (see below)!

Actually rounding variables

It is essential to note that the aforementioned option for setting the number of decimal places only changes the way the results of a calculation are displayed. In reality, however, the variable retains its actual number of decimal places.

In practice, this means that if you assign a value of 2.5 to variable A and set the number of decimal places to 0, it will be shown as 3, but if you multiply A by 2, the result shown will be 5, not 6.

Thus, TextMaker also has a function called ROUND for real rounding. This can be used, for example, as follows:

A = ROUND (2.5; 0)

As a parameter, you specify the value to be rounded and the number of decimal places separated by a semicolon. For example, the above statement assigns a value of 3 to variable A.

For more information on all of TextMaker's computational functions, see Formulas and functions.