I need to pass value from selected choice to an input table and do further calculations on the input table

  • pyli
    Asked on September 12, 2018 at 5:51 AM

    Lets say for example

    I create a multiple choice question for the user to select.

    Each choice has a value (defined of course)

    Lets say choice 1 has 300 points, 2 has 200 points , 3 has 1400 points & so on

    Then in next input table, i want to update the corresponding table with the points and then allow the user to input a value so that total points is calculated from the passed value and the input value to the total value. 

    Then in the last column i need to hard code the max value and then put a condition to limit the total value to max value if it exceed that value.  Screen shot given

    I am ok to not have the max value column but i need to define the upperlimit to total value of each row. 

    1536745874jotform trouble Screenshot 10

  • Kiran Support Team Lead
    Replied on September 12, 2018 at 10:11 AM

    If I understand your requirement correctly you want to display the points value from the checkbox to first column of input table field and calculate the total by using 'No. of activities' value which will be entered by the user. If so, since the calculation values are being used in the checkbox field, when multiple options are checked the total can only be sent. So, it is required to have these options/values to be displayed in the Input table manually by setting another condition. Please see the screencast below for setting up conditions for each selection to calculate the totals.

     15367611221578268 InputTableCalc Screenshot 10

    Here is the cloned version of your form with the above changes that you may want to take a look.

    https://form.jotform.com/82543754068968

    Please refer to the guide below that can help you with performing calculations with input table field.

    https://www.jotform.com/help/414-Calculate-Values-in-the-Input-Table-Through-Condition

    Please get back to us if you need any further assistance. We will be happy to help.

  • pyli
    Replied on September 12, 2018 at 12:31 PM

    Hey Kiran,

    I did the same way, that is hard coding the value in to the equation. However i had put the calculated values in the earlier block 60.Ardminstration 

    So each of them have a value, i was expecting the calculation to pass that calculated value to the row. 


    THe other question was how to limit the total value?

  • AshtonP
    Replied on September 12, 2018 at 1:28 PM

    Unfortunately, there is a limit to what calculations you can perform on the input table. I tried to use conditional logic to achieve the maximum value calculated using the conditional logic to no avail. 

    You will need to use separate number fields for each and style them accordingly. I'll also see if this can be done using other spreadsheets like widgets and update you. 

  • pyli
    Replied on September 12, 2018 at 2:54 PM

    can we use if then else logic in the calculations?

    Or If total(value) > Max(value) then set Total(value)=Max(value) else keep Total(value)

  • Mike_G JotForm Support
    Replied on September 12, 2018 at 4:01 PM

    I'm afraid "If Else" is not available when creating conditions. We will be glad to help you with your concern. Please allow me some time and let me check if I can find a workaround that will meet your requirements. I'll get back to you as soon as possible.

  • Mike_G JotForm Support
    Replied on September 13, 2018 at 10:44 PM

    I have checked the form that has the table shown in your screenshot above and I see that you have set up conditions that will multiply the value in the Points per Activity column by the value entered in the No. of Activities column on each row of the Points of Administration table.

    To get the Total Points in row 1.

    1536890173t21 48 48 Screenshot 10

    The result of the computation will then be shown in the Total Points column.

    However, to my understanding, you would like to limit the values in the Total Points column based on certain max points per row that you will set. Which means if the value in the Total Points column is higher than the max points you set, it should have the max points instead. Otherwise, it should retain the current value in the Total Points column.

    I have a workaround that will meet your requirements.

    In this workaround, we will use the min() math function — Form-Calculation-Math-Function-Reference

    We will have the condition above as an example. You can edit that condition and make it look like the one in the screenshot below.

    1536892458t22 28 36 Screenshot 21

    You will do the same on every condition that does the same to get the total on each row.

    The min() function will return the value of the lowest number in the group. The numbers in the group are separated by a comma.

    Since you are setting the max points in the condition and since you also mentioned that it is okay to not have the Max Points column, the Max Points column can be removed.

    Result:

    1536892794t22 38 Screenshot 32

    You will see that I have set a Max Points of 600 on the first row and 400 on the second.

    I hope this helps. If you have other questions, please feel free to let us know.

  • pyli
    Replied on September 14, 2018 at 6:32 AM

    This cool, thanks a lot. much appreciated.

    However i was thinking of another way. Would like to explore that feature. 

    As you may have noted from the form that the multiple choice has feature of calculated value. 

    Is there a way to set condition to have that automatically passed, so that i dont have to painstaking add a new condition for each of these values. 


    Tommorow if i need to change the values i dont have to search that particular condition. it is so huge.  I just need to go to that calculated value and update the new value, the formulas will remain the same. 


    Is that possible. By now i am exhausted adding so many conditions for the points system :-(

  • pyli
    Replied on September 14, 2018 at 7:17 AM

    The other question i have in mind 

    Can i total all of these segment totals to a cumulative total in another segment?

  • AshtonP
    Replied on September 14, 2018 at 8:48 AM

    Is there a way to set a condition to have that automatically passed, so that I don't have to painstaking add a new condition for each of these values?

    I'll try to find out if this is possible using another a field value instead of a static number that you need to change everytime you change the max value.

    Are you happy to maintain a separate field/s with a max value? You can keep it hidden, however, you just need to change the default value every time you decide to change the max value. I'll come up with the best solution and reply to this thread shortly. You can expect my reply to this thread.

    Can I total all of these segment totals to a cumulative total in another segment?

    Yes, you can do a cumulative total by using our Form Calculation widget. Related Guide: How-to-Perform-Form-Calculation-Using-a-Widget 

  • AshtonP
    Replied on September 14, 2018 at 5:26 PM

    I have further improvised the way you can set Max Points without having to change conditions.

    Create separate numeric fields with default values for each row. Take a look at my form below. I have created those for the first 2 rows.

    Have a look at the condition with min() math function. I used a number of fields instead of the static numeric value in the min() function.

    This means whenever you need to update the max points, you simply need to change the default values of the respective number field. I have kept the max point fields visible in my form, however, you can hide them.

    67477 Selection 808 Screenshot 10

    Have a look at the demonstration of the form here - https://form.jotform.com/82563883072968

    67476 test max value Screenshot 21

    I hope this helps.

  • pyli
    Replied on September 16, 2018 at 11:57 PM

    This is cool, actually meets the purpose, let me try it out


  • pyli
    Replied on September 17, 2018 at 12:16 AM

    How did you put the comma in the equation, can we just type it?

  • Kiran Support Team Lead
    Replied on September 17, 2018 at 1:21 AM

    How did you put the comma in the equation, can we just type it?

    Yes. You can type it in the calculation field as you input any other character.

    Thanks!