Telerik Reporting

Conversion functions:

Function Description
CBool(expression) Converts an expression to Boolean value.
CDbl(expression) Converts an expression to Double value.
CInt(expression) Converts an expression to Integer value.
CDate(expression) Converts an expression to Date value.
CStr(expression) Converts an expression to string value.

Expression evaluation flow functions:

Function Description
IIf(expression, ReturnedIfTrue, ReturnedIfFalse)

Returns one of two objects, depending on the evaluation of an expression. The first parameter is the expression. If the expression evaluates to True the second parameter is returned, if false the third parameter is returned. Both parameters are evaluated prior to the function execution.

Example: prints sum only when vendor is not null: IIf(IsNull(Fields.VendorID, 0)=0,'', Sum(Fields.ContractAmount)).

IsNull(expression, ReplacementValue) Checks an expression and either returns the checked expression or a replacement value. Example where zero is returned if "Price" is null: IsNull(Fields.Price, 0).
Caution

The reporting engine first evaluates the function parameters and then passes the result values to the function. This means that you need to make sure the parameters of the function are valid statements prior to executing the function.

String manipulation:

Function Description
StripHtmlTags(string) Strips the HTML tags from the input text.
Len(string) Gets the number of characters in a string.
SubStr(string, Start, Length) Retrieves a substring from a string. The substring starts at a specified character position and has a specified length. Example: SubStr("Telerik", 0, 3) returns "Tel".
Trim(string) Removes all leading and trailing whitespace from the passed in string.
Format(format, value) Formats the value using the specified format string. Example: =Format(' LineTotal: {0} ', Fields.LineTotal)

Scope related functions

Data scope related functions

  • Exec(scope, expression) - executes the specified expression in the given data scope. Used mostly with aggregate expressions as a second parameter; this function allows changing of the data scope in which the expression is evaluated. Scope parameter is the name of the data scope we need to evaluate the expression against. For example the expression

    =Fields.LineTotal / Exec(' Report1 ', Sum(Fields.LineTotal))

    used in detail section will return the LineTotal amount as percentage from the whole report.

  • RunningValue(scope, aggregateFunction) - the value for RunningValue resets to 0 for each new instance of the specified scope. If a group is specified, the running value is reset when the group expression changes. If a data item is specified, the running value is reset for each new instance of the data item.

    Restrictions for RunningValue are determined by the aggregate function specified in the function parameter. RunningValue cannot be used in a filter or sort expression.

The set of data specified in the expression must have the same data type. To convert data that has multiple numeric data types to the same data type, use conversion functions like CInt , CDbl, etc.

Page scope related function

  • PageExec(itemName, aggregateFunction) - executes the specified aggregate function in the given scope. As the name suggests, it can be used in page header or page footer of the report. In order to specify the scope in which the aggregate would be evaluated, you need to specify a report item as a parameter of the function.

    It takes two parameters:

    • itemName – determines which data objects are included in the page exec accumulation. For each instance of the report item with the specified name that occurs on the current page, its data object is accumulated.
    • aggregateFunction – the aggregate that is accumulated for each page. The expression used as argument of the aggregate function is evaluated against the collected data objects.

    For example the expression

    =PageExec("lineTotalTextBox",Sum(Fields.LineTotal))

    used in a page section (page header or footer) will return the LineTotal summary for every single page of the report.

Note

Page aggregates are supported in page oriented formats only: IMAGE (TIFF, EMF, BMP, JPEG, GIF, Print), PDF, PPTX, DOCX, RTF, XPS.

Report sections / table rows(columns) running count

Function Description
RowNumber(scope) Returns a running count of all rows in the specified scope.
ColumnNumber(scope) Returns a running count of all columns in the specified scope.
Note

Data scope functions cannot be nested.

Access built-in collection functions

Function Description
Fields(fieldName) Returns the value of the field with the specified name in the current data scope. Use this function when you want to dynamically change the referred field. For example you may define string parameter SortField and use =Fields(Parameters.SortField) expression as Sorting of a report.
Parameters(parameterName) Returns the report parameter with the specified name.

Other functions

Function Description
Now() Returns the current date and time on the computer processing the report, expressed as the local time.
Abs(object) Returns the absolute value of a specified number.