
Creating a document using variable objects
35
The Formula data source
The Formula data source contains a list of data sources. These data sources are populated by combinations of
operators, constants, data sources, control variables, formulas, and functions. Data can be numeric or
alphanumeric.
In order to carry out a calculation within a document, you must first create a Formula data source.
This data source has a specific dialog box allowing you to define the required function(s) for a given formula.
Defining the properties of a Formula data source
Command: Data sources > Formula > formulaname > Properties
1. Enter the formula directly in the Edit field.
- or -
Select the elements, and click Insert.
2. Click Test to verify that the syntax is correct. If an error occurs, follow the instructions displayed on
the screen and make any necessary changes.
3. Click OK.
Hint: You can insert an element by double-clicking on it.
Note: If a variable used in the formula has a name containing one of the following characters &+-
*/<>=^%,!\", it must be enclosed in brackets {}.
Note: You can check your formula by clicking Test. If the message displays the formula value, it means that
your formula is correct. If the value is not correct, follow the instructions displayed on the screen to make the
necessary modifications. If the value obtained is truncated, you must modify the maximum length specified in
the Output tab.
Exercise: Creating a simple formula
Displaying the price of a product
In this example, the production label must show the price of the product as a function of its weight and the
price per kilogram.
1. Open a label. Two variables have to be created: WEIGHT and PRICEPERKG.
2. For the WEIGHT variable, enter 788 (the weight of the product is 788 g) as the Local value, enter ''Please
enter the weight in g'' in the Prefix field, then click OK.
3. For the PRICEPERKG variable, enter 15.70 (the price/kg is FF15.70) as the Local value of the variable
4. Enter ''Please enter the price per kg'' in the Prefix field, then click OK.
5. Add a formula and name it Price.
Commenti su questo manuale