Using Formula Fields
Formula fields are managed from Formula Fields screen. Once a calculated field is created, it is placed on Fields List screen. You can then drag and drop it on the report like any other field.
On the Desktop Studio screen, click button from the toolbar.
OROn the Desktop Studio screen, from Tools menu, click Formula Fields. The Formula Fields screen appears with a list of calculated fields (formula fields) designed for the report.
Figure 1:Formula Fields screen
You can perform the following actions:
Action | Description |
Add | To add a formula field on the report |
Modify | To modify the selected formula field |
Delete | To delete the selected formula field |
OK | Saves all the changes made to the formula field |
Cancel | Close screen without making changes to the report |
Up and Down arrow buttons | Select a formula field row and click Up button or Down button to move the selected formula field up or down. When you want to use a formula field within another field, you may prefer to move the “field being used” up to indicate its dependency on the field being created and the one in which it is used |
To add/design a new formula field
Follow the below steps to create formula fields:
On the Formula Fields screen,
Figure 2: Formula Fields screen
Click Add The Formula Fields Expression screen appears.
Figure 3: Formula Field Expression screen
In Name, specify a unique name for the formula field being designed.
In Return drop-down box, select a return type such as number, character, Boolean, and date corresponding to the specified name.
In Expression, specify the formula followed by an ‘=’ sign and specify expression for the field.
Note: Report will not run if there is any syntax error in the formula.
Click Compile button to check the formula for syntax errors.
Click OK to save the created format. The newly designed formula field appears in the list on the Formula Fields.
To edit/modify a formula field
On the Formula Fields screen, select the formula field that you want to edit.
Click Modify The Formula Field Expression screen appears.
Edit/modify the required details.
Click OK to save the changes.
To delete a formula field
On the Formula Fields screen, select the formula field that you want to delete.
Click Delete
Click OK to save the changes.
General syntax
You can make simple to complex formula for a formula field. General syntax for a formula field is:
FormulaName = formula
Follow JavaScript syntax to create a formula. To create formula, you can use field names and define variables. A formula may have if construct as well as nested if construct. You can use logical operators too. If want to add more than one statements in formula, use semicolon ‘;’ as separator between two statements.
Example:
NewForm1 = var a = 5 ; b = 3 ; if (a!=b) { f = a } {NewForm1=f}
TotalAmount = var total ; if (unitprice < 10 ) {total = unitprice*quantity} else {total = unitprice} {TotalAmount = total}
Related content
Copyright Kyvos, Inc. All rights reserved.