Highlighted

If expressions

Avatar

Guest

14-11-2008

How do I create an expression if I want to return a value if another value is > or < a set value? For example:



if ( Subtotal < 25.00 ) then

ShippingCharge = 6.00

elseif ( Subtotal > 25.01 or < 50.00) then

ShippingCharge = 8.00

elseif ( Subtotal > 50.01 or < 75.00) then

ShippingCharge = 10.00

endif



I know this is not the correct syntax but it illustrates what I'm trying to accomplish.

Replies

Highlighted

gkaiseril

15-11-2008

The syntax is listed in the "Scripting Reference" under LiveCycle Designer's menu "Help" option.



if ( simple expression ) then

list of expressions

elseif ( simple expression ) then

list of expressions

else

list of expressions

endif



There are also examples available.



You could also use JavaScript and the "switch{case():...}" statement. Wich might more clearly state and test the comparisons.



What is the shipping charge if the Subtotal is $25.00, $25.01, $50.00 or $50.01? You have to be careful with the end points of ranges.
Highlighted

Avatar

Guest

17-11-2008

Thank you for your help. I found what was causing my problem. I was entering (Subtotal > 25.01 or < 50.00) when it should have been ( Subtotal > 25.01 and Subtotal <= 50.00).