This block is responsible for performing calculations. You can create your formulas and stick it inside this block.
When would this be useful? You want to calculate customer order sales tax, or a discount, or anything else that requires math operations over the data that the business app has. This is handy as you can drag-and-drop any type of data to perform a mathematical operation.
How to use it? Just drag-and-drop the following into your diagram:
Select your block and click the following button:
Depending on your scenario, you can create an expression that will perform a math operation. For instance, you can drag-and-drop previous blocks to select a field:
Once you finish, click the 'Save & Close' button:
Your formula can contain a mathematical expression using any of the following:
What will happen after this block is executed? It will perform the mathematical expression you have provided and store the result inside it. You can then use this result in other blocks. For instance, you can place it inside a user input form, or you can record it into the database, or you can use it inside a 'Decision' block. What you do with this calculation is up to you!
We can easily aggregate database table fields to get results like the sum, minimum, maximum, count, and average (SUM, MIN, MAX, COUNT, AVG). To do this, you’ll need a data access block and a calculation block.
In the formula editor of the calculation block, simply drag and drop your data access block, select the field you want, and then choose the desired operation – like SUM or AVG – from the options provided, as shown below.
In the example above, during runtime, the system will calculate the total of all price fields from the available records and display that sum in the calculation block as the result. You can use this result in a variety of ways. For instance, you can include it in the body of an email, add it to your PDF invoice, save it to another table, or even send it to another system using a REST API. Just a quick reminder: all operations, except for counting, should be performed with numeric data only.
Was this article helpful?
Fenorri 3.1 Beta 5 Now Available!
Would you like to get a beta invite?