Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

If expressions

Avatar

Former Community Member
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

Avatar

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.

Avatar

Former Community Member
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).