How to Insert Text or Mathematical Calculation into a Field Using Conditional Logic

Last Update: June 4, 2016

We have just implemented this as a new feature allowing the use of Calculations based on specific conditions.

To learn more about this, here's my test form https://form.jotform.com/61551439806964. We'll use it as a reference for the steps mentioned below.

1. On Form Builder, click on the Conditions button. 

2. Then select "Update/Calculate Field" option.

 

 

3. First, setup the "IF" statement, this is the rule needs to be met for the conditional logic to trigger its action. Next, set the "DO" statement to "Calculate a field's value".

 

3.1. Below is a screenshot to where we can do a calculation using the input from other fields. In my case, I will add the text box "Number 1" and "Number 2" then output it on a text box named "Total". This conditional action will happen ONLY if text box "Number 1" is filled out. You can see this on my test form.

You can add the other form fields by clicking the "Add Field" button. Make sure that the fields are set to "0-9", meaning their value is numeric. You can also insert your own formula here, you can see the number pad at the right side and the math functions there.

After clicking the save button, this is how it looks like in my Conditions list.

 

 

Here's how it looks like in live form preview:

 

 

 

3.2. Now how to insert a static text? Simply type the text in the textarea field under the "DO" statement. Set the target field where you want to output the text. In my case, this conditional action happens when the specific drop down field in my form is set to "Yes".

 This is how it looks like in my Conditions list:

This is how it looks like in live preview:

 

 

4. Congratulations! You are now able to insert static text or perform your own calculations using Conditional Logic.

 

Related guide that you might also want to check out:

How to Populate Field with a Value From Another Field 

 

 

Got questions? Please let us know below!


15 Comments...


   
agemo (April 06, 2014 at 06:55 PM)

Your example is not working. Besides, I cannot set different values for different choices. It is not working. It shows empty textbox for choices other than first one.

View Answer


   
csanders_watpac (April 14, 2014 at 03:04 AM)

I have three spinners in my questionnaire.
I was hoping to use the choice of the first to automatically set the default minimum of the second and third but can see no way to do that.
i.e. First spinner = Number of support persons within my state = 6 therefore the number of support persons within my Country cannot be any LESS than 6 so I would like the number chosen at State level to set the minimum at Country and International levels for my second and third spinners

View Answer


   
ecoconsumer (May 26, 2014 at 04:15 PM)

when creating any formula, the wizzard doesnt seem to save the formula...

View Answer


   
chrisgal (October 25, 2014 at 07:23 PM)

Can i use "And" contition somehow?
I have 2 drop down fields and 1 calculation field. For example: if user choose "option 1" form the 1st field and "option 2" on the 2nd field then in calculation field a price appears. There is 10 options in 1st field and 10 options in 2nd field. Diferrent prices for diferrent options. How can i do this?

View Answer


   
Gordon (November 06, 2014 at 11:10 PM)

I am looking at a conditional expression that sets a minimum price .... eg if [calc_result 1] * [calc_2]< 40 then [answer] = 40

View Answer


   
branzburg (January 28, 2015 at 06:10 AM)

I was trying to get this feature to work with text. If I have a field "NAME" and a field "CITY" can it concatenate the two fields? For example, if the NAME field contains "Joe" and the CITY field contains "London" I'd like a 3rd field to automatically contain "Joe London"

View Answer


   
admirgv (February 22, 2015 at 06:46 PM)

Hi I need to calculate the square meter
if you can help out with the formula?

THX

View Answer


   
uxindia (September 29, 2015 at 08:20 AM)

I want to use conditional statement auto counter. when auto counter hits limit set it should throw exception to the user not to submit form.

Ex: I have a radio button with four values (A, b, c, d). If either of this value auto increments to 100, i would like to restrict new users from submitting form. how do i achieve this

View Answer


   
natalieu (September 29, 2015 at 09:21 AM)

Hi, I've added some update form values - depending on answer different text - and I want this "calculation" to show up in the autoresponder results.

Although I've added the field the output doesn't show up. What have I missed?

For example if bullet point 2 is selected, the text says bullet point 2 answer - that's what I want to show up in the email. Is that possible and if so how?

View Answer


   
cris74 (April 13, 2016 at 06:28 PM)

How insert 14/04/2016 in date field, when another field is equal to "yes" ?

View Answer


   
KCCwebservices (August 19, 2016 at 03:07 PM)

How do you use this update/calculate a field within the Matrix Dynamique widget?

View Answer


   
JS2706 (August 29, 2016 at 01:23 PM)

Wondering how I would show the total number of nights from the Check in and Check out fields. Kind of like hotels do.

View Answer


   
AnnaNCeldran (September 08, 2016 at 11:48 AM)

if i want a name to have a maximum of 22 characters (letters) not including spaces in between and not counting the comma and period how do I encode in it the condition box?
in the update/calculate field i was able to do this: surname (a-z)(,)(space) first name (a-z) (space) middle initial (a-z)(.) total: name but I want to put a condition that states that the total number of characters should be less than or equal to 22 then ok but if total characters is greater than 22 then error

View Answer


   
JS2706 (September 18, 2016 at 10:34 PM)

How would I calculate the cost ($35/night) based on total number of nights, which is fixed until the 7th night, and then there's a discount. There is an additional $10 discount after every 7 nights... so for example, 3 nights would be $105, 9 nights would be $305, and 15 nights would be $505.

I would also like to add in other fields to this number, but not sure how to do it from a drop down menu with many different choices.

Any help would be greatly appreciated!

View Answer


   
millionairemoss (September 21, 2016 at 12:37 AM)

I have a 10 question quiz with mainly yes or no values being either 1 or 2. I would like the quiz to auto score at the end and take them to a page where they enter their email address and name to be added to my email list. How can I assign numerical values to text in my form and have those values calculate at the end of the form? This tutorial does not help with that.

View Answer


Send Comment