Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Division Calculation - HELP!!!!

New Here ,
Jul 15, 2021 Jul 15, 2021

I'm attempting to place a divison calulcation in a filable form and I keep getting this error: 'The value entered does not match the format of the field [TotalCompPerHoursWorked].

I would like the following calculations to work. Total Compenstation Paid ÷ Hours Worked = Total Comp Per Hours Worked.

I have the following as values for each item... 

Total Compenstation Paid (AdditionalComp, CompHoursWorked)

Hours Worked (Value is not calculated)

Total Compenstation per Hours Worked (TotalCompPaid/HoursWorked)

I have these Text Field Properties for Total Compenstation per Hours Worked :

Number

1,234.56

Before with space

 

I also have a Name and Date text box at the top of this form. If I type in them I get the error code as well.

I very new to this. I have done basic addition and subtraction in Adobe with no problems.

I can't to find a simple answer to my challenge on the internet. Any help with a simple explanation would be most helpful!

TOPICS
PDF forms
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jul 16, 2021 Jul 16, 2021

Error happens because you used SFN to divide two fields and it try to divide with zero so you can get Infinity or NaN errors in your field, instead use "Custom calculation script" and try this code:

var x = this.getField("TotalCompPaid").value;
var y = this.getField("HoursWorked").value;
if(y == 0) event.value = "";
else
event.value = x/y;

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 15, 2021 Jul 15, 2021

Hi there

 

Hope you are doing well and sorry for the trouble. As described you need help with division calculation.

 

The workflow you are trying to achieve is possible using a custom calculation script. For more help, please check the help article https://acrobatusers.com/tutorials/javascript_console/

 

Hope it will help

 

Regards

Amal

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2021 Jul 16, 2021

Error happens because you used SFN to divide two fields and it try to divide with zero so you can get Infinity or NaN errors in your field, instead use "Custom calculation script" and try this code:

var x = this.getField("TotalCompPaid").value;
var y = this.getField("HoursWorked").value;
if(y == 0) event.value = "";
else
event.value = x/y;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 23, 2021 Jul 23, 2021

Thanks everyone for the help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 26, 2021 Jul 26, 2021

This is the solve.  You are awesome!!!!!!!!!  Thank you Nesa.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 26, 2021 Jul 26, 2021
LATEST

This is the solve.  You are awesome!!!!!!!!!  Thank you Nesa.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines