Formula Fields Step
The Formula Fields Step allows you to create calculated fields based on existing fields in the data source. These calculated fields are populated at runtime and can be used to perform complex calculations such as interest amounts or totals.
Action Buttons
Action | Description |
---|---|
Add | Add a new formula field to the Query Object. |
Delete | Delete the selected formula field. |
Formula Field Properties
When adding a formula field, you can configure the following properties:
Property | Description |
---|---|
Name | Name of the formula field as visible to the end user. |
Return Type | Specifies the data type of the formula field. Options include Number, Char, or Date. |
Precision | Defines the length of the field for Char data type or the precision for Number data type. |
Scale | Specifies the number of digits after the decimal point for Number data type. |
Formula | The formula string, written using JavaScript syntax. You can use field names, define variables, and use logical operators. |
Formula String Syntax
Formulas in Kyvos Reporting are created using JavaScript syntax. You can create formulas with conditional logic and variables, and use logical operators for more complex calculations. Each statement in the formula must be separated by a semicolon (;
).
Example:
To calculate the total amount based on unit price and quantity, you can create a formula as follows:
var total;
if (unitprice < 10) {
total = unitprice * quantity;
} else {
total = unitprice;
}
TotalAmount = total;
This formula checks if the unit price is less than 10. If so, it calculates the total as unit price multiplied by quantity; otherwise, it just uses the unit price as the total.
Related content
Copyright Kyvos, Inc. All rights reserved.