calculated field in form builder

Formula Field Guide

Construction of advanced calculation form

Have you ever thought of designing a form to automatically calculate and display math or cost calculations? Calculation operations in formican will be possible with the help of the formula field, which is included in the category of advanced fields. To learn more, you can follow us in this article to get the desired result.

Calculation operations in the form builder

You may have this question, why should we create the possibility of computational operations in formican? Why do you need this field?M?
This possibility is used in the form builder for simple and complex operations such as:

  • Commodity cost calculations
  • Weight calculation for health and medical websites
  • calculation of calories (fitness)
  • calculation of hotel cost for reservation
  • Calculating appointments and services
  • loan calculation
  • Leave calculation
  • GPA calculation
  • Printing cost calculation
  • calculation of service activities
  • Calculation of test result
  • And…

Features in the formula field

  • Calculating a formula field in another formula field
  • Calculating all the fields inside a panel by selecting the panel title
  • Easy to use for writing formulas
  • Support for historical calculations (distance between 2 dates based on the day, month and year of the solar and Gregorian calendar)
  • Support for hour calculation (difference between 2 hours)
  • Possibility to insert prefix and suffix for the calculated value
  • Determining the style and how to display the calculated value
  • Possibility of establishing a condition for the formula field
  • Transfer to payment gateway based on formula field value

Different parts of the formula field:

There are generally 4 sections in the formula field settings.

Formula Field Guide

1. Fields: In this section, form fields of numerical type are displayed.

FNumerical yields
number date clock
dropdown list optional radio button
status selected image slider
formula related list rank
Satisfaction selection table

2. Functions: In this section, there are 4 functions, each of which is in the following modes.

Function Name How to use permitted field
year difference
YearDiff( Date field , Date field )
date field
month difference
MonthDiff( Date field , Date field )
date field
Day difference
DayDiff( Date field , Date field )
date field
clock difference
TimeDiff( Hour field , Hour field )
clock field

3. Mathematical operators: This section contains numbers and operators of multiplication(*), division (/), addition(+) and subtraction(-), which are placed in the formula editor by clicking on them.

4. Formula editor: In this section, you can write the required formula using the keyboard, operators, functions and fields.

Getting started with formula fields

In a simple example, we are going to check how to work with the formula field in the form builder, we want to create a form so that its registrant receives cleaning services by selecting the defined values.
The design of the form is in such a way that the user first selects the type of activity he wants, then selects the activity area, the date and time of the presence of service people.

Formula Field Guide

Finally, the form automatically calculates the service fee based on the selected values.
For each option of the type of activity in the form, an amount needs to be determined, so we enter the settings of this field, which is a radio field type, and enter the amounts in the "numerical value" section.

Formula Field Guide

Also, for "hours of activity" which is a list field type, we do numerical value in the same way.
To calculate the price, we put a formula field from the category of advanced fields in the form and write the formula in its settings as follows to calculate the cost.

Formula Field Guide

Now, if the user selects the type of activity "Home and workplace cleaning" and the amount of hours "2 hours", the type of activity which is 40 thousand tomans will be multiplied by 2 and The final cost is equal to 80 thousand Tomans.
In this simple way, we created a smart form to calculate service fees based on user requests. Also, to receive the calculated services, we can use the online payment feature and consider the formula field as the final amount.

tips in formula writing

1. Since the invention of modern algebraic symbols, multiplication precedes division, division precedes addition, and addition precedes subtraction. To avoid mistakes in calculations, it is better to use () for operations, otherwise, the priority of operators should be taken care of.

2. Among the fields in the formula field, only the date and time fields can be used in functions, and the date and time fields cannot be used alone, if these conditions are not met, the formula will not be confirmed and saved.

3. If you have used several formula fields in a form and the fields are dependent on each other, you should pay attention to the fact that at least one field must have a fixed value to calculate without depending on the next formula fields. In fact, if there is a loop between the fields, the output will be zero.

4. If less or more than 2 arguments are placed for the functions or the function fields are not of the specified type, the formula will not be confirmed and saved.