Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you!!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Thank you!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now