## Using Radio Button Selections to Calculate Bonus

New Here ,
May 17, 2019

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
| 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

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

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
| 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

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
4 Replies 4
May 17, 2019

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".

Likes

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
Most Valuable Participant ,
May 19, 2019

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

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 19, 2019 0
May 19, 2019

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

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 19, 2019 0
LATEST
New Here ,
May 20, 2019