GoCanvas has the ability to calculate things for you, helping to eliminate mathematical errors and save you time. There are endless possibilities and reasons for performing calculations in an App.
A common use of this field type is for calculating billable items such as time and materials. We'll use this example to show you how to set up successful calculations in an App.
Calculating Number fields
To create a "Total" Calculation field, follow these steps:
- Launch the GoCanvas App Builder.
- Drag a Number field from the field palette into your App and label it "Quantity".
- Drag another Number field into your App (or copy the previous field) and label it "Unit Price". In the Unit Price field's Field Settings, change the Style to Currency.
- Drag a Calculation field from the field palette into your App and label it "Total". In the Total field's Field Settings, change the style to Currency.
- Under the Calculation header, select Create Calculation.
- Select Quantity for Operator 1.
- Select the Multiplication icon.
- Select Unit Price for Operator 2, then click Done.
That's it! The Total field will automatically multiply the Quantity and Unit Price field for you.
You can add as many fields as necessary to achieve your end result. Simply click New Operator to add more fields and operators to the calculation.
Calculating fields with Constants
If you would like to calculate something using a constant (static) number, an easy way is to add a constant variable by clicking the Add Constant button.
For example, if you apply the same tax rate of 6% to all of your billable items, you can Add a Constant of 0.06 and multiply it with your Total field. Simply follow these steps:
- Drag a Calculation field from the field palette into your App and label it "Tax". In the Tax field's Field Settings, change the style to Currency.
- Under the Calculation header, select Create Calculation.
- Select Total for Operator 1.
- Select the Multiplication icon.
- Delete Operator 2, then add a New Operator.
- Select Constant, then enter the decimal form of your percentage (in this case 6% = 0.06). Click Done.
You can use multiple fields and Constants in a single Calculation field.
To get the grand total of your item total plus tax, you'll simply set up one more Calculation field adding up those two fields.
Want to learn more ways to use Calculation fields in GoCanvas? Click here to learn more about calculations in loop screens, and here to learn more about calculating time.
Comments
0 comments
Please sign in to leave a comment.