1 Reply Latest reply on Nov 20, 2010 9:57 AM by Steve L Walker

# If calculation

How can i do the following calculation:

Values/Fields are:

Amount:
[DISCOUNT1] 10
[DISCOUNT2] 20
[DISCOUNT3] 30

Percents:
[DISCOUNTIF1] 1
[DISCOUNTIF2] 2
[DISCOUNTIF3] 3

Total:
[TOTALDISCOUNT]

The calculation should go something like this:
If total amout is over 10[DISCOUNT1] and below 20[DISCOUNT2], the [DISCOUNTIF1] is 1,
If total amout is over 20[DISCOUNT2] and below 30[DISCOUNT3], the [DISCOUNTIF2] is 2,
If total amout is over 30[DISCOUNT3], the [DISCOUNTIF3] is 3.

• ###### 1. Re: If calculation

Is this what you are after?

// form1.page1.subform1.discount::calculate - (FormCalc, client)

if (HasValue(totalPrice)) then

if (totalPrice > 10 and totalPrice < 20) then

\$.rawValue = totalPrice * 0.01

else

if (totalPrice > 19 and totalPrice < 30) then

\$.rawValue = totalPrice * 0.02

else

if (totalPrice > 29) then

\$.rawValue = totalPrice * 0.03

endif

endif

endif

else

\$.rawValue = null

endif

Steve