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.
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. Ex. "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. Ex. "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. Ex. "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. Ex. "#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. Ex. "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. Ex. "#Parameters["OrderID"]#"
In This Section
| See Also |
Functions | Aggregate Functions | Dictionaries | Programming with ReportWriter for .NET
