Level 1

0% to

Level 2

Tip /

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

View all

New to LiveCycle and was dumped a project to complete.

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile
watermeleng
Level 1

11-01-2017

I'm trying to creating a form where there will be 3 fields.  two numeric fields and a third numeric field where I'd like to show the total percentage ex: field A 70 / field B 100 *100 = Field C (Total Percentage) but I keep getting a arithmetic underflow error.  Need some help

I thought it would be something like:

Field C=FieldA/FieldB*100

but I keep getting the arithmetic underflow error.  The formula actually works but I'm trying to get rid of that error.

Accepted Solutions (1)

lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

13 solutions
View profile

lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

13 solutions
View profile
lateniteNC
Level 3

12-01-2017

I did not set any default values to Field1 and Field2 - they are just user entered fields and will appear blank on your form.  In order to avoid dividing by zero, you have to first determine if there are values in Field1 and Field2. In my example, if either Field1 or Field2 is blank, I set the value of Field3 to 0 (using an "If, elseif, then" statement). Only when there are 2 values will the division operation occur.

The code is formcalc, entered in the calculate event of Field3.

if (HasValue(Field1) eq 0) then

Field3 = 0

elseif (HasValue(Field2) eq 0) then

Field3 = 0

else

Field3 = Field1 / Field2

endif

An example is found here:  Dropbox - Avoid Division by Zer0.pdf

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile
watermeleng
Level 1

16-01-2017

Thank you so much lateniteNC.  I was stumped on why the formula wouldn't work and I did a little more digging and I found a script that was written in the ALL EVENT script editor that was giving me the error codes.  I removed the script and everything is working perfectly.

Thanks again.

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile
watermeleng
Level 1

16-01-2017

hey lateniteNC, I can't seem to figure out how to upload my form into the forum.  Have any recommendations on how I can do that?

lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

13 solutions
View profile

lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

13 solutions
View profile
lateniteNC
Level 3

14-01-2017

If you can upload your form I will take a look. Looks like you make have a reference name issue but cannot tell until I can view the form.

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile
watermeleng
Level 1

13-01-2017

Hi lateniteNC,  thanks again for all the help.  I imputed the formcalc code in and this is what im getting:

I replaced the Field 1, 2, 3 with the names appropriate to the names on the worksheet.

Again thanks for all the help.  I am super super noob when it comes to this..

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile
watermeleng
Level 1

13-01-2017

Hi lateniteNC,  thanks again for all the help.  I imputed the formcalc code in and this is what im getting:

I replaced the Field 1, 2, 3 with the names appropriate to the names on the worksheet.

Again thanks for all the help.  I am super super noob when it comes to this..

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile
watermeleng
Level 1

12-01-2017

hi latenite..thanks for responding.I am not familiar with writing an ( if..then statement.)  I know where I need to write it but what would the if statement look like if possible?

lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

13 solutions
View profile

lateniteNC
Level 3

Likes

12 likes

Total Posts

98 posts

13 solutions
View profile
lateniteNC
Level 3

12-01-2017

You actually just answered your own question. When the form is rendered, because the default of the second field is zero, you are attempting to divide by zero - which is generating the error.

What you need to do is set up a If .... Then statement in the calculate event of Field3. If the fields are zero, put zero in Field 3. If the two fields have values, then perform Field1 / Field 2.

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile

watermeleng
Level 1

Likes

0 likes

Total Posts

7 posts

0 solutions
View profile
watermeleng
Level 1

12-01-2017

The fields are set to default zero.  The  fields are set where the users have the option to fill in a numeric value.  If no value has been inputted, then the value is zero

geegee734
Level 1

Likes

0 likes

Total Posts

13 posts

0 solutions
View profile

geegee734
Level 1

Likes

0 likes

Total Posts

13 posts