Need help creating a composite calculation with conditional logic and multiple variables

  • Profile Image
    gtglass
    Asked on September 08, 2017 at 09:01 AM

    Hi! I am trying to create a Product Finder/product recommendation engine with a form. Essentially, we have 4 tools (a,b,c,d) that we would suggest based on answers to 5 questions (combination of multiple choice and yes/no). I want to assign a point to the specific tool (a,b,c,d) based on the answer to each question and at the end, show a screen with the highest total scored tool on it, or a ranking of the tools based on their scores. I think that this can be done with the calculator, but may need multiple variables. I haven't been able to figure out a way to do this, any thoughts? I am open to all suggestions, do you have any ideas?

  • Profile Image
    BJoanna
    Answered on September 08, 2017 at 11:25 AM

    You can perform a calculation with the Form Calculation widget or with the Conditional logic. 

    How to Perform Form Calculation Using a Widget

    Conditional Logic Inserts Text/Calculation Into A Field

    If you are using the fields like radio button, check box or dropdown, you can assign them calculation values. 

    How to Assign Calculation Value

    If you are unable to set a calculation inside of your form, please provide us the ID of the form you are working on and provide us more details about the calculation that you want to set. 

  • Profile Image
    gtglass
    Answered on September 08, 2017 at 11:42 AM

    Hi BJoanna, Thanks for the answer, but you didn't really answer my specific question. How do I specifically create 4 variables, and assign points to each variable based on answers to questions. These points then need to be tallied up and displayed in a ranked order at the end of the form. 

  • Profile Image
    BJoanna
    Answered on September 08, 2017 at 12:02 PM

    I'm sorry, but I do not fully understand what you are trying to achieve. You have only this form on your account and that form has only one field. 

    Do you want to set 5 yes/no questions and perform a different calculation based on selected options for each of your 4 products? And finally, show the product with the highest score?

    If that is the case then most likely you will have to perform a separate calculation for each product.

    Should the 5 questions have different values or the same values for each product? 

    Please create a demo form with 5 yes/no questions and 4 products and tell us how should the calculation be performed for each product. Also tell us the values/points of the yes/no questions?

  • Profile Image
    gtglass
    Answered on September 08, 2017 at 12:55 PM

    Here is how I am envisioning it working. 

    The 4 variables (products) should be:
    Tool A
    Tool B
    Tool C
    Tool D

    Below is a chart listing how many points are assigned to each variable based on the choices made

     

    For Example:
    Let's say someone chose the following answers:

    6-10 repairs

    Budget $1,000 to $1,500

    150 repairs with initial investment

    No Long Crack Repairs

    The variables should have the following scores:

    Tool A: 2
    Tool B: 3
    Tool C: 3
    Tool D: 1

    These would then be ranked in order of greatest to least:

    I.E.
    Tool B
    Tool C
    Tool A
    Tool D

  • Profile Image
    BJoanna
    Answered on September 08, 2017 at 01:21 PM

    Please allow me some time to create a demo form. I will update you once I create a form. 

  • Profile Image
    BJoanna
    Answered on September 08, 2017 at 01:43 PM

    To create a form that will accomplish your needs, I had to create 4 additional fields for each of your questions. I also had to set 18 conditions to update those fields based on the options that will be selected. I also added 4 Form Calculation widget to perform a separate calculation for each Tool. 

    I will explain how I did this for one of the questions.

    For Question 1, I added 4 additional Short Entry (Text box) fields.

    The I had to set 1 condition for each of the options and pass the value 1 to a text box field, based on the option that was selected. 

    Conditional Logic Inserts Text/Calculation Into A Field

    I did the same for all other questions. 

    Then I set a calculation for each Tool. For Total Tool A, I had to summ all Tool A questions (1, 2, 3 and 4). My calculation looks like this.

    Here is my demo form: https://form.jotformpro.com/72505011298956 

    Feel free to test it and clone it

    Also please note that you can hide all question fields that are used for the calculations. I left them visible so that you can see how the values are passed and how the calculation is performed. 

    Hope this meet what you are looking for.

  • Profile Image
    gtglass
    Answered on September 08, 2017 at 03:49 PM

    Thanks so much, this is fantastic. 

    How would you take those 4 ranked tools and just display the top ranked tool with conditional logic? If two tools are tied, show both. 

    Here is the link. https://form.jotform.us/72503493220145

  • Profile Image
    Jim_R
    Answered on September 08, 2017 at 05:02 PM

    I'm glad BJoanna's solution worked great. Now, displaying the tool total with the highest score can be achieved using 4 conditions. The conditions below, on their own, should take care of displaying whichever is the highest.

    Logic:

    IF A > B/C/D THEN SHOW A

    IF B > A/C/D THEN SHOW B

    IF C > A/B/D THEN SHOW C

    IF D > A/B/C THEN SHOW D

    However, displaying both tools that are tied at top spot can be quite tricky and I'm not sure this is doable with conditions. It's also worth noting that with certain combinations, there's a chance to get 3 total tools tallying the same scores.

    e.g. Selecting...

    - 1-5 Repairs

    - $1,000 to $1,500

    - 300

    - Yes

    ...would yield to a result of:

    Total Tool A = 2

    Total Tool B = 2

    Total Tool C = 2

    Total Tool D = 1

    Does this mean you want to display all 3 of them when all 3 were tied at the same top spot as well? Perhaps further explaining to us your end goal on why you need to show both (if there's a tie) would allow us to offer a better suggestion.

  • Profile Image
    gtglass
    Answered on September 08, 2017 at 05:10 PM

    Thanks Jim, 

    That conditional logic makes sense to me and I was trying to figure out what to do with ties at this point. Our end goal would be to push someone toward purchasing a higher profit product, so If there is a tie and its easier to just display one tool, I would really like to display the most profitable one. No real need to display multiple tools. Here is the order of profitability for the tools:

    (Least to Most Profitable)
    Tool A
    Tool B
    Tool C
    Tool D

    Let me know how you think I should tackle displaying the most profitable product if there is a tie.

  • Profile Image
    david
    Answered on September 08, 2017 at 05:59 PM

    I believe the following list of conditions would cover it.  All would be set to trigger if ALL rules are met.

    If A = B
    If A > C
    IF A > D
    Show A

    If A = C
    If A > B
    IF A > D
    Show A

    If A = D
    If A > B
    IF A > C
    Show A

    If B = C
    If B > A
    If B > D
    Show B

    If B = D
    If B > C
    If B > A
    Show B

    If C = D
    If C > A
    If C > B
    Show C

    This would give priority to A over B over C over D in the event of a tie.