Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

If expressions

Not applicable
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.
2 Replies
gkaiseril
Level 7
Level 7
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.
Not applicable
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).