Copy link to clipboard
Copied
Hello Good People! 🙂
Forwarning you that I have no experience with scripts....
I'm trying to figure out how to calculate the total rate per person based on the radio button (i.e. Method of Compensation) selected.
Scenario: Based on what type of premium work performed (overtime, holiday, comp time) will determine the percentage of their hourly rate in which they will be paid. Not sure if it would be easier to deal with decimals.
- Overtime 1.5 or 150%
- Holiday 2.0 or 200%
- Comp Time 0 or 0%
Sample portion of form is below:
Thanks in advance!
Copy link to clipboard
Copied
Let's say your radio buttons are named "Group1" with export values of 1.5, 2, and 0.
If you already use a custom calculation script in your 'Total' field, add this after your script:
var rb = this.getField("Group1");
if(rb.valueAsString == "1.5" || rb.valueAsString == "2")
event.value = Number(event.value)*Number(rb.valueAsString);
Copy link to clipboard
Copied
Sorry for the late response. I had a chance to go back and I don't know if it's my version of Adobe but I'm not seeing an option to add a value to a radio button. Would it be easier to create a drop down with values? This is the only option I have when I go into properties.
Copy link to clipboard
Copied
There you use the value 1.5%
Copy link to clipboard
Copied
If you're going to use it in a calculation the value needs to be just a number (no "%") and adjusted to be a percentage, so use "0.015" for "1.5%", "0.02" for "2%", etc.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now