## Making Multiple Variable Assignments in One Formula:

This formula is for myself. I keep forgetting the syntax and so I have posted it here so that I can find it when I need it.You are allowed to assign values to two variables in one formula, simply by separating the assignments with semicolons. This gets a little more confusing when you are within nested If-Then logic. The formula below shows you how to do four assignments if the condition is TRUE and a different four assignments if the condition is FALSE. This formula will increment each of the 4 variables with one amount if the order is under $1,000. The increment will be 10 times that amount if the order is over $1,000.

Three things to notice:

1) The set of assignments after THEN or ELSE are contained inside a pair
parentheses.

2) Within each pair of parentheses the assignments are separated by semicolons.

3) The If - Then - Else steps themselves are NOT separated by semicolons.

The last line is not
necessary, but it allows the formula to display the contents of all four
variables at once on the report. Without this last line the
formula would simply show the value of the last assignment. Remove the two
comment marks (leaving the semicolon) for this line to activate.

Whileprintingrecords;

Numbervar one; Numbervar two; Numbervar three; Numbervar four;

if {Orders.Order Amount} < 1000

then (one := one + 1; two := two + 2; three:= three+ 3; four := four + 4 )

else (one := one + 10; two := two + 20; three:= three+ 30; four := four + 40 )

// ; Totext(one,0,'') + '-' + Totext(two,0,'') + '-' + Totext(three,0,'')+ '-' + Totext(four,0,'')