Enter a formula, like you would do in Excel, to calculate the result of two form fields. The result will be displayed in the current field. 


In the following example, we will set a basic number field that simply subtracts two number fields:


  1. Add a number field and enter Amount1 as Name

    NOTE: Always give names to the fields like you would do in Excel. For example, do not just write Amount, instead write Amount1 - where represents a cell reference.

  2. Add another number field and enter Fee1 as Name.



  3. Add another number field and enter Amount1-Fee1 in the Calculated Field. This field will subtract the transaction fee from the transaction amount, just according to the formula we have given to it.

Now, we have three fields on the canvas.



  1. From the top, click the Test tab to see the form in action.

  2. Enter 44 in Transaction Amount and 12 in Transaction Fee as shown below



  3. The Actual Amount field will display the result as follows.


Formulas

This field allows a variety of different formulas that you can use to achieve different results.


Divide, Multiply, Add and Subtract

Pragmeo supports all commonly used mathematical operators of divide, multiply, add, and subtract.


Example

In the following example, we have two fields with the Names of A1 and A2. 



We will create four fields for checking how each of the mathematical operators works. 


In the Calculated Field, enter the following formulas for each of the fields.


Add

A1+A2


Subtract

A1-A2


Multiply

A1*A2


Divide

A1/A2


Click Save from the bottom and go to the Test tab. There, you can change the values to see the results on runtime.


SUM()

Adds a range or individual field references. 


Example 1: Adding a Range of Fields

In the following example, we will add four fields as a range. To do this, you must Name all the fields like Excel cell references: A1, A2, A3, A4 as shown below.


We will add another field, and enter this in the Calculated Value field:


SUM(A1:A4) 


The following image illustrates the configuration of this field.



Click Save from the bottom and go to the Test tab. There, you can change the values to see the results on runtime.



Example 2: Adding Form Fields Separately

In the following example, we will add only two fields out of four, though you can add more fields. To do this, you must Name all the fields like Excel cell references: A1, A2, A3, A4 as shown below.


We will add another field, and enter this in the Calculated Value field. 


SUM(A1,A3)


Notice the comma in between A1 and A3.



Click Save from the bottom and go to the Test tab. There, you can change the values to see the results on runtime.



Notice that modifying the values in A2 and A4 fields does not make any effect on the SUM. The reason is our calculated field is only adding A1 and A3 field values.


IF() Condition

Checks if the provided condition turns out to be TRUE; if it does, the first value of the formula is used, otherwise the second.


EXAMPLE

In the following example, we have three fields: A1, A2, and A3.



The field A3 adds the A1 and A2. 


Let's add another field called A4, which will check if the value in A3 is greater than 50 or not. If it's greater than 50, the field will display "Great", otherwise "Add bigger numbers." 


For this, enter this in the calculated field:

IF(A3 > 50, "GREAT", "Add bigger numbers")


 The following image illustrates the configuration for the A4 field.



Click Save from the bottom and go to the Test tab. There, you can change the values to see the results on runtime.