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

Pay Increase Percentage Calculation

Community Beginner ,
Nov 02, 2022 Nov 02, 2022

Hello,

 

I'm needing to create a calculation to determine the pay wage percentage increase on a form. I'm struggling with the formula/calculation needed. I am getting an error stating that the field doesn't match the output.

 

Essentially needing, =((HourlyEmployeesNewPayRate-CurrentPayRate)/CurrentPayRate)*1

 

Laura249011215wnk_0-1667398190498.png

 

TOPICS
PDF forms
809
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
2 ACCEPTED SOLUTIONS
Community Expert ,
Nov 02, 2022 Nov 02, 2022

This will happen when the divisor is empty, as it would be division by zero. You need to use a script that checks that the field is not empty (or zero) first, and then perform the calculation.

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
Community Expert ,
Nov 02, 2022 Nov 02, 2022

As mentioned above you need custom calculation script, something like this:

var a = Number(this.getField("HourlyEmployeesNewPayRate").valueAsString);
var b = Number(this.getField("CurrentPayRate").valueAsString);
if(b)
event.value = ((a-b)/b)*1;
else
event.value = "";

What is the point of multiply by 1?

If you set field format as percentage, then instead of multiply by one, you need to divide by 100.

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
Community Expert ,
Nov 02, 2022 Nov 02, 2022

This will happen when the divisor is empty, as it would be division by zero. You need to use a script that checks that the field is not empty (or zero) first, and then perform the calculation.

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 ,
Nov 02, 2022 Nov 02, 2022

Thank you!!

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 ,
Nov 02, 2022 Nov 02, 2022

As mentioned above you need custom calculation script, something like this:

var a = Number(this.getField("HourlyEmployeesNewPayRate").valueAsString);
var b = Number(this.getField("CurrentPayRate").valueAsString);
if(b)
event.value = ((a-b)/b)*1;
else
event.value = "";

What is the point of multiply by 1?

If you set field format as percentage, then instead of multiply by one, you need to divide by 100.

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 ,
Nov 02, 2022 Nov 02, 2022
LATEST

Thank you!

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