Calculation

This field is used to calulate a value based on the value of another field. This acts really helpful while calculating sums, averages etc among others.

{
"type": "calculation",
"id": "age",
"label": "Number - 10",
"showInTable": true,
"calculateValue": {
"returnType": "number",
"dep": ["number1", "number2", "number3"],
"exp": "(data.number1 + data.number2 + data.number3) / 3 || 0"
}
}

The example above is dependent on three fields with id's — number1, number2, and number3. It takes the average of the 3 and returns a number type. The user can modify the expression to their needs.

Field Attributes

NameTypeDescription
idstringAssigns a name for the given field on the backend. This name can be used to refer this field in another field
labelstringAdds a label to the given field
isRequiredbooleanMakes a field mandatory
showInTablebooleanDisplays the field in a table after saving the entry
depobjectIndicates the dependencies of the current field
expstringStores the expression to make the desired calculation