Low-Code Designer > Custom forms / Calculated fields

Calculated fields

QuickBPM can automatically calculate field values on app pages. For instance, it can calculate the total price of an order including VAT or a customer discount. The system can also show or hide particular fields depending on conditions.

These options become available when you switch to the advanced mode form editing. Go to the Context tab and click on the property you want to set up. In the provided settings window check the Set a formula for the field box and/or Show only when a condition is met.

00.PNG

Let's take a look at how these settings work.

Setting a formula for a field

This option is only available for string, number, and money field types.  

Let's say a company sells and delivers heating installations. When an order is made, the sales rep enters all the details into the system: the customer's name, the goods purchased, the delivery date, etc. They might also want to enter a discount. Since the discount may vary depending, for instance, on the order's size, it is convenient to use a formula to calculate the total amount to be paid.

01.PNG

To set up this behavior, open the order form for editing. Go to the "Context" tab and create a new Total with discount property. Select the Money type since we are calculating the final amount to be paid.

02.PNG

Check the Set a formula for the field box. The required Forumla field will appear. Click on the plus symbol {+} in the right corner of the line. A list of app fields with pop up. Select Total amount (this is the right table column, where the total price of the order is calculated before the discount is applied) and Discount (this is the field where the sales rep enters the discount's amount when registering the order). You can add, subtract, calculate and divide the values with the following operators: +, -, *, /. Use parentheses () to define the order of operations.

Your final formula shall look as follows:

03.PNG

Save the changes. Now, when filling in the order form, the sales rep will enter the purchased products, the number of items purchased, and the discount amount. The system will automatically calculate the total amount to be paid minus the discount.  

04.gif

Showing fields based on conditions

Sometimes you need to hide or show fields on the form depending on certain conditions. Let's say our company provides different delivery options, including pickup and courier delivery. When a sales rep registers a new order, he or she specifies the delivery method selected by the customer. If the customer has selected courier delivery, an additional address field will appear on the form. In the case of pickup, the field will stay hidden.

07.gif

To set up this behavior, open the order form for editing. Go to the Context tab and create a new Delivery address property. Check the Show only when a condition is met box and then click on the Set up conditions link.

04.PNG

In the pop-up, you can now set up the show condition for the field. If the conditions are not met, the field will remain hidden.

05.PNG

  • Operand 1, 2: select a property from the app's context or specify a particular value.
  • Operation: select the operator for checking this condition.

If you want to set up multiple conditions, you have to link them with logical operators that will be used for checking the conditions. The field will be shown if the result is true.

06.PNG

Operators:

  • AND: the result is True if both conditions are met;
  • OR: the result is True if at least one of the conditions is met;
  • OR NOT: the result is True if at least one of the conditions is not met;
  • AND NOT: the result is True if both conditions are not met.

Note that conditions are checked in the order they are listed.