User guide

Creating a document using variable objects
33
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 source > Formula > Properties.
1. Enter the formula directly in the Edit box.
- or -
Select the elements of your choice, then click Insert.
2. Click Test to verify that the syntax is correct. If an error occurs, follow the instructions displayed on
the screen and carry out 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 carry out
the necessary modifications.
If the value obtained is truncated, you must modify the maximum length specified in the Output tab.
Demonstration: Creating a simple formula
Displaying the price of a product
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 created: WEIGHT and PRICEPERKG.
2. For the WEIGHT variable: Enter 788 (the weight of the product being 788 g) as the Local value, and enter
''Please enter the weight in g'' in the Prefix box, then click OK.
3. For the PRICEPERKG variable: enter 15.70 (the price/kg being FF15.70) as the Local value of the variable,
and enter ''Please enter the price per kg'' in the Prefix box, then click OK.
4. Add a formula and name it price.
5. Enter the formula WEIGHT*PRICEPERKG/1000, then click OK.
6. Save your document.
Demonstration: Adding the "Warning" Formula variable for displaying a warning message
In the following sequence, we will create a formula to display a warning message telling the user that the value
of the Total_Weight shared variable exceeds 1,000kg.
If the weight value exceeds 1,000kg, the message ''Attention! Error! Total Weight exceeds maximum!'' will