
User Guide
36
6. Enter the formula WEIGHT*PRICEPERKG/1000, then click OK.
7. Save your label.
Exercise: Adding the "Warning" formula variable to display a warning message
In the following exercise, we will create a formula to display a warning message telling the user that the value
of the Total_Weight shared variable exceeds 1,000 kg.
If the weight value exceeds 1,000 kg, the message ''Attention! Error! Total Weight exceeds maximum!'' will
appear.
1. Open the label.
2. Create a formula and name it ''Warning''.
3. In the Formula dialog box, enter the following expression: if(Total_Weight>1000, ''Attention: Total Weight
exceeds maximum!'', '''')
4. On the Output tab, enter 50 in the Maximum length field and click OK.
5. Position the variable as text within the label.
6. In the Text dialog box, select Scalable as the font and set its Height to 12.70 mm.
7. On the Paragraph tab, select the Wordwrap option, then select Centered in the Alignment field.
Information on the IF function
The IF function returns one value if the condition you specify is TRUE, and another value if it is FALSE.
Use the IF function to carry out conditional tests on values and formulas.
Syntax
if("expr","val_if_true","val_if_false”) ”expr" represents any value or expression, the result of which can be TRUE
or FALSE.
val_if_true is the value returned if "expr" is TRUE. The val_if_true argument can be another formula.
val_if_false is the value returned if "expr" is FALSE. The val_if_false argument can be another formula.
Komentarze do niniejszej Instrukcji