In the Report Viewer, the Report Editor, and the Report Definition rule form, you can use the Calculation Builder to select an SQL function, a literal value, or a column name. You can build nested expressions in the Calculation Builder by using an SQL function as the parameter value for another SQL function.
A large number of standard SQL function templates are provided. For a list, see Standard SQL function rules. If these standard rules do not meet the needs of your report, you can create a Function Alias rule. For more information, see About Function Alias rules.
You open the Calculation Builder by clicking the Calculation Builder icon .
When the Calculation Builder opens, it displays a single field where you can select an SQL function to use. Type the first few characters of the function you want, or use the Down Arrow key to display a list of available functions. Standard functions are listed first, followed by custom functions that were created by application developers.
When you select a function, a description of the function and its use is displayed, along with prompts for any parameter values that are required.
Note: When entering parameter values for a function, you must specify a literal value, a property, or an SQL function of the correct data type.
If you use a function that compares date values, you can compare a date column by using one of the following:
Note: While expressions using SQL functions can be nested, application performance might degrade if you use highly-nested SQL functions. Consider creating custom SQL functions that contain highly complex logic.
Also, if you have an SQL function that includes CASE WHEN logic, and you want drill-down in charts to work properly, define your SQL function to return a NULL value instead of zero when a condition fails.
The SQL functions shown in the Data Explorer and listed when you click the Calculation Builder icon change if a data transform named pyReportEditorFunctions is available for the primary class of the report. This data transform rule generates a Code-Pega-List, which specifies a list of SQL functions to be shown, using the function names. The system populates labels and data types at run time. If pyReportEditorFunctions returns a null list, the Calculations tab does not appear in the Calculation Builder for the Report Editor. Developers always see the full list of functions when working directly with the Report Definition rule form.
To provide a customized list for a report:
You can use other names for the pages, as long as you use the same names on the Definition tab. You must use the indicated classes.
This process creates a single function in the Calculation Builder. Repeat as needed to assemble the full list of functions to display.
Whenever possible, optimize the properties you want to use in your reports. Reporting on unoptimized properties causes a performance drain on the system. If you create reports using unoptimized properties, you will see warning messages in the Report Editor or the Report Definition rule form.
On SQL Server, there is a limitation to the size of the value that a report definition rule can report on using the Calculation Builder to get values out of the BLOB (that is, from an unoptimized property). If a value is greater than precision 18, scale 6, SQL server returns an error.