Skip to main content

Expressions Overview

Version: 8.0

Expressions

Expressions can be used to perform a number of things including math, string manipulation and retrieving parameters and database fields. They can be used in a number of places in ReportWriter as outlined below.

In This Section​

Operators

Functions

Aggregate Functions

Dictionaries

Conditions

Record Box​

The Field property of a Record Box can contain an expression. Note: Only one expression can be used, however expressions can be nested. For example:

"Multiply(UnitPrice, Quantity)"

Record Area and Formatted Record Area​

The text property of a Record Area or Formatted Record Area can contain expressions. These expressions are placed between pound signs and are replaced with the evaluated value in the report output. For example:

"Hello #FullName#. Your order total is #Add(SubTotal, Freight)#."

Document Properties​

The Title, Subject, Author and Keywords properties of the DocumentLayout can contain expressions, but can only access report parameters and application settings. These expressions are placed between pound signs and are replaced with the evaluated value in the report output. They cannot use aggregate functions or access database data because there is no Query defined at this level. For example:

"Order #Parameters["OrderID"]#"

Query Connection String​

The connection string of a query can contain expressions as well. These expressions are placed between pound signs and are replaced with the evaluated value when building the connection string. These are limited to AppSettings, ConnectionStirng and Parameter indexers. For example:

"#ConnectionString["NorthwindConnectionString"]#"

SQL Statements​

SQL statements can contain expressions that refer to a parent query. These expressions are placed between pound signs and are replaced with the evaluated value when building the SQL statement. Aggregate functions cannot be used in a SQL statement. For example:

"SELECT * FROM Order WHERE OrderID = #Parameters["OrderID"]#"

Stored Procedure Values​

The value of a stored procedure can contain expressions that refer to a parent query. These expressions are placed between pound signs and are replaced with the evaluated value when building the stored procedure it executed. Aggregate functions cannot be used on a stored procedure value. For example

"#Parameters["OrderID"]#"