Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Question - calculation for two user-entered numbers

Avatar

Former Community Member

I have a form where the user is required to enter two values (A and B) in order to perform a calculation.  Problem is, the calculation is A/B, so when they enter Value A, an overflow error message immediately pops up on the form (because it is trying to divide by zero).

What is the script so that the error message does not appear, so the user can enter both A and B values without the overflow error immediately appearing upon entering value A?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

you can wrap your script into an if expression.

if (valueA ne 0 and valueB ne 0) then

     valueA / valueB

endif

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

you can wrap your script into an if expression.

if (valueA ne 0 and valueB ne 0) then

     valueA / valueB

endif

Avatar

Former Community Member

Thanks, I did finally figure it out, and your way works fine.  The way I found is

if (valueB ne 0 & HasValue (valueB)) then

valueA/valueB

else

null

endif