All Collections
Advanced App Building
Advanced App Building
Math Calculations, Totals, Sums, Count, Average
Math Calculations, Totals, Sums, Count, Average

How to setup calculations and calculate elements in your workflows. tax rates, costs, totals, sums, math, averages, etc.

James McDonough avatar
Written by James McDonough
Updated over a week ago

Numeric elements have different features and performing math calculations is one of them. If you add a numeric element to your workflow and expand its details, you will notice that it contains a VARIABLE NAME field.

Variable Names are the tag we will use later to reference this element's value. For example, in the screenshot from above, there is a horizontal section called "Details" where we have a very common case where each row of the horizontal section has a Product name, its price, the quantity, and a Sub-total. Sub-total will be the result of PRICE multiplicated by QUANTITY. If the variable name is what we need to reference an element's value, and the Price variable name is @PRICE, then the variable name of Sub-total will look something like this:

If the variable name of Sub-total is @PRICE * @QUANTITY, this means that Sub-total will automatically be updated when the user enters a value under PRICE and a value under QUANTITY.

If you also want to have a TOTAL value to sum all of the Sub-totals from all the rows of the horizontal section, you need to activate the "Calculate totals in Table" checkbox and select Sum as the desired operation. It will look like this:

As a result of all these, while using this workflow, your users will see something like this:

Keep in mind that you can use math calculations outside horizontal sections as well. And you could also calculate DateTime elements as well. For example, you can have a Journey Inspection workflow where the driver is supposed to enter the departure date and time into a DateTime element and also capture the date and time of arrival into another DateTime element. And you can assign variable names to these fields so you can subtract one another into a numeric element which is the math calculation that will show the duration of the journey expressed in hours as the result.

What's Next?

Overview of Command Center

Did this answer your question?