Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Working with Literals in Formulas and Filters (Report Builder 1.0)

Working with Literals in Formulas and Filters (Report Builder 1.0)

Filter conditions and expressions can both use literals and variables. A literal is a constant value whereas, a variable represents a set of values that can change. For example, suppose you add the literal value #12/15/2005# for a date to a formula. When the results of the formula are displayed, the date "12/15/2005" is displayed as well. If you were to use a variable, the data would change depending on the underlying data source. For example, you might use the field OrderDate in the formula; the result would display each instance of the OrderDate field.

To indicate to Report Builder that the value should be treated as a literal, you need to use a specific symbol depending on the type of data.

The following table indicates which symbol is used with each character type.

To make the following a literal:

Use this symbol:



For example, the literal date #1/25/2009# renders as: 1/25/2009.



For example, the literal time #14:19:42# renders as: 14:19:42.

To display a datetime value as a time value, you must format the field to use one of the following custom datetime format strings on the Number tab of the Format dialog box: u, f, or s.

You can enter literals as DateTime Offset values but Reporting Services automatically converts them to DateTime UTC values.The Offset portion of the DateTime Offset value is removed after the value is converted.



For example, the literal string "The following bicycle parts are replaceable:" renders as: The following bicycle parts are replaceable:



For example, the literal decimal 1.435m renders as: 1.435.

Note the following when working with literals:

  • Float, integer, and Boolean values do not require a special symbol.

  • The Define Formula and Filter Data dialog boxes are not case sensitive; therefore, function names and Boolean values can be typed in lowercase or uppercase letters. Case sensitivity of strings depends on the underlying data source.

  • Report Builder automatically converts a decimal to a floating value when required in the formula; therefore, you can create formulas that require this conversion without having to specify whether the value is a float or a decimal.

Community Additions

© 2015 Microsoft