How to Perform Form Calculation in the Matrix Field?

Last Update: November 25, 2016

It is now possible to use the Matrix field to perform form calculation.

This will depend on the input type, but the steps should still be the same. Here in our example, we will set the matrix field similar to a survey questionnaire with ratings or value on them, we will calculate the total rating using the Form Calculation widget. You can follow the steps below on how to do that.

 

How to set values on each column on a matrix field.

1. Add the Matrix field by dragging it in your form. In my case, I will use the default the radio button as the input type. How to add values on each column? We can do that by changing the column names to numbers. In this case, I will change “Very Satisfied, Satisfied, Somewhat Satisfied, Not Satisfied” to “4, 3, 2, 1”.

2. Add a Form Calculation widget.

3. In the “Calculation window”, click the “Add Field” button to add the fields you want to fetch the value from, in this case it’s the Matrix field.

4. Choose the Matrix Field based from the label you used.

5. Choose what rows you want to fetch the values.

6. You can then use different math functions or values to perform your calculation. In my case, I want to add all the selected radio buttons to have the total score of the survey questionnaire.

 

You can check the sample form here: http://form.jotformpro.com/form/51691444490963?

 

How to set hidden values on each column on a radio input type.

You want to have each column to have it's own value, but you do not wish to display them to your users? That is possible by following the steps below with the knowledge we acquire on the earlier part of this guide.

1. Here, add the matrix field, we will list the labels and the values under the "Columns" option.

 

2. This is how we will list down the labels and the value on each column. This is how it looks like:

Very Satisfied 4

Satisfied 3

Somewhat Satisfied 2

Not Satisfied 1

 

After the label we will wrap the value set on the column in a span element. This is for us to easily get its CSS path and differentiate it on the label.

 

3. We will then use this CSS code to hide the elements in the matrix field that holds a value on each column.

.form-matrix-table > tbody > tr > th > span {

    display: none !important;

 

}

Paste the custom CSS code under the CSS tab in your Form Designer Tool.

 

4. Save the changes and follow the earlier part of this guide on how to insert each column selection in the form calculation widget.

You can check this form to see how the changes above looks like: https://form.jotform.com/53412133432947

 

Do you have questions about this guide? Please let us know in the comment box below or post it to support forum.


6 Comments...


   
events296 (June 29, 2015 at 10:51 AM)

I have tried to output the sum of a matrix's fields multiple times. Every time I save the logic the fields are removed and all I am left with in my equations is the addition signs.

View Answer


   
Communicaid (March 04, 2016 at 06:14 AM)

Hello,
I've created a matrix question with dropdown list "yes" and "no" and I wwould like to add the values to the "yes"=1 and "no"=0.
my question is: can I use the same role live above : yes1?
what is the css code to hide the numbers?
Thank you in advance for your help

View Answer


   
Communicaid (March 04, 2016 at 10:52 AM)

ok, thank you for your help


   
IDOEWebmaster (June 22, 2016 at 10:54 AM)

How do I multiply the value of column 1 and column 2 and show the result value in the column 3 of the matrix table?
Thanks.

View Answer


   
jannyfer.chua (August 05, 2016 at 04:22 AM)

Hi,

I have a set of 28 questions and 5 radio columns (Never, Rarely, Sometimes, Very often, Always).

a) How do I set values for each column and when they are selected, the values are added up? e.g. Never=1, Rarely=2, Sometimes=3, Veryoften=4, Always=5 
if Never is selectedx2, rarely x1, always x2 = the total is 14.

b) How do I set the 28 questions to calculate 4 different totals from the above columns. eg. Qs 1-7, 8-14, 15-21, 22-28 and then set a formula to only show the results for the highest total?

View Answer


   
aysaquing (August 15, 2016 at 04:48 AM)

Can I set condition on form matrix calculation? For example if column 5 as remarks says Best, the calculator will just compute all fields (rows) with best. Is that possible? Thanks.

View Answer


Send Comment