---
title: "Formulas in Checklists"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/3525115909/Formulas%20in%20Checklists"
format: markdown
---
A Formula field is a **client-side**, **readonly** field that displays an output of a formula that uses other fields as parameter. Formula Fields can be applied by using Formula type on the Work Order (Line) Item Detail component. 

> ⚠️ Formula should be in the following format: `(params)=>{return 'result'}` . Following will not work:
> ⚠️ 
> ⚠️ - `() => {return 'result'}` (no spaces before or after `=>`)
> ⚠️ - `()=>{return "result"}` (use `'` instead of `”` )

### Example 1: Sum Calculator

The following example presents a formula field displaying a sum of 3 other fields: A + B + C.


**Example 2: Accrued Interest Calculator**

The following formula calculates accrued interest over the principal amount (API Name: `PA`) given the rate of interest (API Name: `ROI`) and accrual period in days (API Name: `D`).


## Recommendations

- Refrain from creating formulas that do operations on text or return text. While these will work most of the time, this is not a user-friendly practice and might not work as expected in all cases. If you want to specify a range of values that should be invalid, use help texts to specify these beforehand.
- Be careful when constructing formulas to avoid operations with undefined results, such as dividing by 0, taking the square root of a negative number, etc.
- If entered values are likely to be decimal numbers, remember to specify the number of decimal places by using [toFixed](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) before returning the value. Otherwise you may see unexpected results when operating with decimal numbers, such as the following case:
  - `0.1 + 0.2 -> 0.30000000000000004`