Need to integrate calculations into complex form -- what's best way? Widget? Logic? Payment Integration?

  • tamsyn
    Asked on August 18, 2017 at 3:56 PM

    Hello JotForm staff,

    I'm building a complex and lengthy form that we will share with potential sponsors of our annual conference (it's called "PFI Annual Conference Sponsorship Options, located here: https://form.jotform.us/72156817603154).

    The form needs to present the sponsor options, and also allow users to select a range of options, including:

    1). their sponsorship level

    2). possible add-ons, such as for special features they need for their sponsor display table areas

    3). food options -- with option for selecting quantity

    We will be using Square payment integration.

    I have so far built this form using pages and conditional logic. I have NOT yet layered in calculation values, as I'm trying to figure out the best way to add in the capacity for form users to opt for an optional box lunch -- and then to select the quantity they desire.

    What I was hoping I could achieve is that the options a users selects throughout the form will be stored and transferred somehow to the final payment page.

    I was anticipating I'd need to set up my Square integration to "user-defined" and use your widget that shows the total cost (forget the name offhand), and the have users enter in that final amount at payment.

    However, I'm now getting stumped on the food part ... I can't seem to figure out how to let a user select a box lunch option and then indicate how many box lunches he or she wants. 

    The calculation associated with the field would need to be able to take the cost for one box lunch and multiply by the the entered quantity.

    For example, a box lunch costs $15. We have four types of box lunches, and users can select as many as they like. So someone could, for instance, choose two of the sandwich options, 1 of the vegetarian sandwich options and 1 of the salads.

    I can't figure out how to do this so that my form will proceed as originally envisioned -- where entries input earlier in the form are stored and passed to the final Payment page.

    I feel that would be simpler than having to enter every single option (sponsor levels, table / exhibit space needs, food, etc.), as "products" in the integration setup.

    Can you please advise me on what might be the simplest way to do this?

    Many thanks,

    tamsyn

  • Kevin Support Team Lead
    Replied on August 18, 2017 at 4:30 PM

    As I can understand, you would need to show some options based on the user's selection, then get the final amount based on what the user decided to purchase. 

    Based on your explanation, the best way to achieve it would be through calculations as you will be able to handle the fields with conditions and show/hide each option based on what the user is selecting on another fields. 

    I have cloned your form and I'm currently reviewing it, please allow me some time to work on it and provide you with some steps about how this can be done. 

    In the meantime, I would recommend you to take a look on the following guides that will provide you more details about how form calculation works: 

    How-to-Perform-Form-Calculation-Using-a-Widget

    How-to-Assign-Calculation-Value

    How-to-Pass-a-Calculation-to-a-Payment-Field

    Conditional-Logic-Inserts-Text-Calculation-Into-A-Field

    I will get back to you as soon as possible. 

    Thanks. 

  • tamsyn
    Replied on August 21, 2017 at 2:57 PM

    Hi Kevin,

    Thanks very much for your reply -- and certainly, I understand you'll need some time to explore options. 

    Just so you are aware, I'm not yet done building the base form -- I still need to add options for selecting type and quantity of box lunch options, but was hoping to hear what the best way to do that would be so that the form is capable of auto-calculating the cost if a user selects a quantity greater than one.

    I'll keep experimenting, and will wait to hear back from you.

    Best,

    tamsyn

  • tamsyn
    Replied on August 28, 2017 at 2:24 PM

    Hi there again JotForm staff,

    Just wondering if anyone has had a chance to play around with my form yet and suggest the best solution for me?

    I need to get this form operational pretty soon.

    Thanks!

    tamsyn

  • Kevin Support Team Lead
    Replied on August 28, 2017 at 3:10 PM

    I have been checking your form and noticed that you have a lot of fields that you need to include on your total. 

    For example, the first option that I think would be included in the calculation is the "What level do you wish to sponsor at?", I can see you have already added the price per option in the labels, but you need to add calculation values to each option. 

    The calculation values can be found under the options tab, turn on the "Add calculation values" option and set the value that each option will have.

    1. 

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 1 Screenshot 70

    2.

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 2 Screenshot 81

    I have noticed that most of your fields are radio buttons so you only need to add the calculation value to each option. 

    On the page 10 of your form I can see you are asking for additional box lunches, there you only need to add a Form Calculation value and perform the calculation to get the sub-total for additional boxes: 

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 3 Screenshot 92

    The last step would be to include all the fields in the total, this will be done with the Form Calculation widget as well: 

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 4 Screenshot 103

    Just include all the fields you need to sum to get the total: 

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 5 Screenshot 114

    The last step is to pass the calculation to the payment field: 

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 6 Screenshot 125

    You can also see my sample form here:  https://form.jotformpro.com/72296763656975 

    Feel free to clone it.

    You could also add some formulas to the calculations, I would also recommend you to check the guides I provided above in order to get more details about how to perform calculations, assign calculation values and how to pass the calculated value to the payment field. 

    I hope this helps. 

  • tamsyn
    Replied on September 1, 2017 at 7:45 PM

    Hi Kevin,

    Thank you so much for that detailed reply and all the screenshots -- they were very helpful!

    I've fleshed out my form more, because I realized that how I had the lunch options set up wasn't going to quite work for the potential variability of what users could enter.

    Everything seemed to be going smoothly -- I added calculation values where needed, and used the Form Calculation widget to create subtotals on relevant pages, so users could see at each stage what cost they were committing to.

    I thought it should work easily, since I had to assign a value of zero to the fields where, for instance, there was an option extra fee (if they selected "No, I don't need that" the value would be zero).

    I then added a subtotal field on each sponsor level page and a final subtotal under the lunch option.

    I thought it should work to just add all the various subtotals -- since any sponsor level NOT chosen (I assumed) should have a zero entered by default.

    BUT, that does not seem to be the case.... there's some weird math going on and the Final Subtotal field is coming up WAY higher than is correct.

    Also, the C-Level subtotal doesn't appear to be working, though it's set up similarly to how the other individual sponsor-level subtotals are set up (and the others appear to be working).

    Can you please provide any insights into what's going on? I double-checked how I set up the Final Subtotal field to make sure I didn't accidentally select the multiplication function rather than the addition function ... I did not. So no idea what's going on!

    Here's the form link again: https://www.jotform.com/build/72156817603154

    Thanks so much for your help with this!

    tamsyn

  • jonathan
    Replied on September 1, 2017 at 9:03 PM

    Hi,

    I have reviewed the discussion thread and I see that the calculation requirements were indeed a bit more complex than normal.

    Please allow us some more time to review and figure out a working resolution. I will provide updated response on this thread as soon as I have a resolution available.

    Best

  • tamsyn
    Replied on September 2, 2017 at 6:45 PM

    Hi Jonathan,

    Thanks for your note. I understand it may take a little bit to figure out a possible resolution, but just curious if you have any estimate of how long that will take?

    I'm rapidly approaching the deadline of when I need this form to be ready, so if I can't get the calculations to work correctly, I'll need to figure out some other way of handling sponsorship options this year (and will need time to create that, probably another paper form).

    What I just don't understand about the FINAL SUBTOTAL field that's the one causing issues in my form at present is why it's not just transferring the zeros from any sponsor level not chosen ... 

    Incidentally, I did get the C-Level Subtotal field to work correctly ... just deleted it and re-entered and it seemed to work -- which makes me wonder if perhaps there's an intermittent bug in the Form Calculation widget....?

    Thanks again for your help with this difficult form.

    tamsyn

  • jonathan
    Replied on September 2, 2017 at 7:18 PM

    Correction: the video in the previous message was incorrect.

     

    Sorry for the delays. I was able to determined the caused of incorrect calculation total.

    First I suggest you test my test form https://www.jotform.com/72447371060957

    In the 1st Sub Total (Sponsorship Level) select only A-Level $1,300

    See the video below how I test it.

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 1 Screenshot 70

     

    As you can see in the video I only selected 1,300 and yet the Final Total is 7800. It shows that 1,300 was multiplied by 6.

    I found that this was being caused by the mistake in every Sub Totals Calculations in the form. 

    See images below to understand what I was referring to.

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 2 Screenshot 81

     

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 3 Screenshot 92

     

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 4 Screenshot 103

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 5 Screenshot 114

    Need to integrate calculations into complex form    whats best way? Widget? Logic? Payment Integration? Image 6 Screenshot 125

     

    ....

    Check each of your Sub Totals calculation formula and you will see what I meant.

    So you can fix this by correcting the calculations formula. You can remove the Sub Total (Sponsorship Level) in all the other Sub Totals and just add only instead in FINAL Sub total together with Sub Totals A,B,C,D,E 

    I hope this help. Let us know if you are still not able to fix and need further assistance.

     

  • jonathan
    Replied on September 2, 2017 at 7:26 PM

    If you want to display Sub Totals in each of the Sub Total A,B,C... pages + Sub Total (Sponsorship Level), you just need to add a separate Calculation widget for the display.

    So you can use each correct Sub Totals (without Sponsorship Level on them) in Final Sub Total.

  • tamsyn
    Replied on September 5, 2017 at 4:36 PM

    Thank you so much, Jonathan!! Your suggested fix worked -- and with your video, I was able to see and understand the flaw in my original logic about using the SUBTOTAL: Sponshorship Level as part of the calculation for the subtotal fields in each of the sponsor-level pages.

    I also added, as you suggested, a separate calculation under each sponsor level page.

    For anyone out there who might be following this thread, here's what I did: I selected only the fields with an added fee on each page (A, B, C, or D) and manually entered in the sponsorship cost into the Form Calculation widget.

    e.g. -- For A-Levels, I had the widget set up to access the Extra Table field + 1300.

    Thanks again, JotForm staff, for all your help with this!!

    Now the form is able to pretty much all I really wanted it to do -- and testing so far is showing it all to be working (we haven't yet tried actually submitting a test payment with Square, but fingers crossed it will all work).

    Best,

    tamsyn

  • David JotForm Support Manager
    Replied on September 5, 2017 at 5:49 PM

    On behalf of my colleague, you are welcome! And we appreciate that you shared the steps you applied, so this can be helpful for someone else.

    Open a new thread if you need anything else, we will be glad to assist you.