Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Discounting total amount due numeric field

Avatar

Level 2

I am working on a registration form and need to apply a discount if two particular checkboxes are selected. 

Checkbox #1 – Early registration = $1595

Checkbox #2 – Standard registration = $1795

Checkbox #3 – Special rate = $495

Checkbox #4 – Optional workshop = $395

Numeric Field – Total Payment Due

If the user selects checkbox #1 (early) or #2 (standard), they have to pay the $395 for the optional workshop.

     Total box =

     sum (EarlyReg, StandardReg, SpecReg, WorkshopReg) <-- THIS WORKS

If the user selects BOTH checkbox #3 (special registration rate) AND checkbox #4 (optional workshop), they do not pay for the workshop.

So instead of $890, they will pay $495.

     Total box =

     ?????

I welcome any ideas you may have and would love to hear if you think I'm going at this in the wrong direction.

I am new to this...would appreciate a step-by-step with syntax. Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 2

TundraSteve, Thanks for the reply.

Your suggestion got me on the right path. Here's what worked using FormCalc on the TotalDue field:

if (SpecReg + WorkshopReg == 890) then

  SpecReg

else

  sum (EarlyReg, StandardReg, SpecReg, WorkshopReg)

endif

Thanks again!

View solution in original post

2 Replies

Avatar

Level 8

 

It would be something like this, hope this at least gives you some direction....

if ((SpecReg == "1") & (WorkshopReg == "1")) then
     Total = sum (EarlyReg, StandardReg, 495)
endif

Avatar

Correct answer by
Level 2

TundraSteve, Thanks for the reply.

Your suggestion got me on the right path. Here's what worked using FormCalc on the TotalDue field:

if (SpecReg + WorkshopReg == 890) then

  SpecReg

else

  sum (EarlyReg, StandardReg, SpecReg, WorkshopReg)

endif

Thanks again!