﻿ Calculate totals and counts on a form | Flowfinity Knowledge Base

# Calculate totals and counts on a form

Users often benefit from being able to see values calculated based on data they've entered. When nested fields are used with calculated values, users can ensure they've inputted the appropriate data and/or provide additional information to customers.

### Example

A technician who has just finished a job records the labor and parts used while on-site. A calculated field shows the total cost of all parts used, allowing the technician to quickly check for major errors, and notify the customer of the cost of service.

#### Instructions

1. In the Form section, create a nested grid field to contain the list of parts used.
Note: Set the 'Field Name' for this field to something easy to remember, e.g. 'Parts List'
2. Click the 'Customize nested form' button and create two fields:
1. An 'input' type field for 'Part Description'
2. A 'money' type field for 'Line Cost'
Note: Set the 'Field Name' for this field to something easy to remember, e.g. 'LineCost'.
3. Click on 'Nested Field Properties' and display the appropriate columns
4. Save the nested grid field
5. Create a new 'Money' type field called 'Total Parts Cost'
1. Click on the 'Abc' icon to the right of the field type, and change the selection to 'formula calculation'
2. In the 'Formula' field, enter the following text: SUM(PartsList.LineCost). If you used different field names for your parts list nested grid or your line cost field, substitute the field names appropriately. Be sure to use the 'Field name' value and not the 'Field label' value when using formulas calculations.
6. Repeat step 5 to create a numeric 'Parts Count' field and use the following formula: COUNT(PartsList)
7. Save the form, and publish the application

#### Additional Information

Several types of fields can have their values calculated from other values on the same form. Values can be formatted as plain text, dates/times, as well as numbers. See the 'Formula Field Syntax' documentation for Flowfinity Actions to see a comprehensive list of formulas and examples. Calculated values can also be used as inputs into other calculations.