You are viewing limited content. For full access, please sign in.

Question

Question

Calculating Form Fees based on checkbox combinations

asked on April 15, 2021 Show version history

I'm setting up an application that people where people can pay their fees depending on the application type. I've configured BrainTree, but I'm not sure how to ensure the correct amount is charged. 

Fees are based on a check box field, and depending on which combination of items are selected the a certain fee would apply. How would I connect this to the correct amount?

0 0

Replies

replied on April 19, 2021

I would create a field below the checkboxes for amount owed. In that field, you can use a calculation to determine the amount owed based on each checkbox choice

=SUM(IF(Checkbox.choice_1,5,0),IF(Checkbox.choice_2,10,0),IF(Checkbox.choice_3,15,0))

This formula says take the sum of the following values: If choice 1 is checked, add 5. If choice 2 is checked, add 10. If choice 3 is checked, add 15. This field will update based on the checked choices and the value you assign to each of them. 

When you select "Collect Payment" on the message start event or user task, you can use the variable of this new field to set payment amount. 

(If you'd like, you can also set up a field rule to hide that field and Save data when it's hidden if you don't want it to show up on the form)

0 0
replied on April 19, 2021

Thanks Jared! 

That is definitely on the right tack, but the only issue I see in this is the combinations can change the price, ie it's semi-consistent. The combination of two items doesn't always have the same value. An example below is: 

A = $100

B = $200

A+C = $300

B+C = $500

So when A and C are combined C=$200, but when B and C are combined C=$300 which makes this a bit trickier.

Maybe I can do your suggestion for some values, but I'll have to find another solution for the variable values. 

0 0
replied on April 19, 2021

Then you need to use conditions for each option

Outcome A: A 
Outcome B: B
Outcome C: C
Outcome D: A + B
Outcome E: A + C = 350
Outcome F: B + C = 400
Outcome G: A + B + C = 500

=IF(AND(Checkbox.choice_1,Checkbox.choice_2,Checkbox.choice_3),500,IF(AND(Checkbox.choice_2,Checkbox.choice_3),"400",IF(AND(Checkbox.choice_1,Checkbox.choice_3),"350"....)

Make sure to check the most restrictive first (if all are checked), then if not that, if these two are checked, if these other two are checked... and at the end, if just A is checked. 

 

0 0
replied on April 19, 2021

Jared, this is where it would be nice if we could just use values for each of the checkboxes and then sum them up. Without them having to be unique or start with a letter.

1 0
replied on April 19, 2021

We'll look into it. The problem is we store these values as XML which must start with a letter or underscore. We'd have to change the architecture a bit to support that. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.