Using Radio Button Selections to Calculate Bonus

New Here ,
May 17, 2019

Copy link to clipboard

Copied

I've been tasked to create a simple form to help sales reps in our company calculate their bonus. I am a creative person, but not a coding/technical person, so I have this cool idea in my head but I don't know how to make it work. I've scoured the internet and forums and have found some helpful threads but can't seem to find what I'm looking for. So here's what I'm trying to do:

Our sales reps have 4 targets that they need to hit (ex./ "category 1," "category 2," etc...) Depending on how many of those targets they achieve, their bonus can increase.

- Example:/ If a sales rep sells 10 units and only hits 1 target category, then their sales are multiplied by $10. If another sales rep also sells 10 units, but hits 2 target categories, then their sales are multiplied by $20. 3 targets = multiply by $30, and all 4 targets = multiply by $40.

The way my form is set up is I have a field for the quantity of units sold, where they simply input a number. I then have 4 groups of (yes/no) radio buttons for them to select whether or not they hit their target in each category. Depending on the number of 'yes' selections will determine what number to multiply the total units sold by.

I don't know if it's easier to use  if/else statements or maybe it would be easier to sum the number of 'yes' selections and then determine what to multiply by?

I hope this makes sense, and any help is greatly appreciated! Thank you!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

You don't need any code to do it, actually, if you set it up correctly.

Just set the "Radio button choice" value of the Yes fields as 1 and of the No fields as 0, and then you could use the built-in Sum function under the calculate tab of your total text field to sum them up directly.

TOPICS
Acrobat SDK and JavaScript

Views

151

Likes

Translate

Translate

Report

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

Using Radio Button Selections to Calculate Bonus

New Here ,
May 17, 2019

Copy link to clipboard

Copied

I've been tasked to create a simple form to help sales reps in our company calculate their bonus. I am a creative person, but not a coding/technical person, so I have this cool idea in my head but I don't know how to make it work. I've scoured the internet and forums and have found some helpful threads but can't seem to find what I'm looking for. So here's what I'm trying to do:

Our sales reps have 4 targets that they need to hit (ex./ "category 1," "category 2," etc...) Depending on how many of those targets they achieve, their bonus can increase.

- Example:/ If a sales rep sells 10 units and only hits 1 target category, then their sales are multiplied by $10. If another sales rep also sells 10 units, but hits 2 target categories, then their sales are multiplied by $20. 3 targets = multiply by $30, and all 4 targets = multiply by $40.

The way my form is set up is I have a field for the quantity of units sold, where they simply input a number. I then have 4 groups of (yes/no) radio buttons for them to select whether or not they hit their target in each category. Depending on the number of 'yes' selections will determine what number to multiply the total units sold by.

I don't know if it's easier to use  if/else statements or maybe it would be easier to sum the number of 'yes' selections and then determine what to multiply by?

I hope this makes sense, and any help is greatly appreciated! Thank you!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

You don't need any code to do it, actually, if you set it up correctly.

Just set the "Radio button choice" value of the Yes fields as 1 and of the No fields as 0, and then you could use the built-in Sum function under the calculate tab of your total text field to sum them up directly.

TOPICS
Acrobat SDK and JavaScript

Views

152

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 17, 2019 0
Adobe Community Professional ,
May 17, 2019

Copy link to clipboard

Copied

Summing radio buttons is the way to go. Especially if they are grouped by naming them with the "dot" notation.  However, you will still need a conditional to determine what to add in the sum.

here's a code snippet, assuming the Yes button has an export of "Yes".

sum += (this.getField(RadioName).value == "Yes")?1:0;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 17, 2019 0
Most Valuable Participant ,
May 19, 2019

Copy link to clipboard

Copied

You don't need any code to do it, actually, if you set it up correctly.

Just set the "Radio button choice" value of the Yes fields as 1 and of the No fields as 0, and then you could use the built-in Sum function under the calculate tab of your total text field to sum them up directly.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 19, 2019 0
Adobe Community Professional ,
May 19, 2019

Copy link to clipboard

Copied

True, I was going to mention that, but without more information it's hard to know what they want. Better to have a generic solution that handles no choice.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 19, 2019 0
New Here ,
May 20, 2019

Copy link to clipboard

Copied

Thank you both! try67​ that was easy enough and worked for what I needed. I thought it would be way more complicated than that.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 20, 2019 0