What Is an Expression?


Expressions are a VB.NET statement that resolves to a single value of a .NET type, such as Integer, String, and so on. Much like VB.NET statements, expressions can be composed of constants, variables , functions, and operators. Most expressions are nothing more than simple strings or VBA constants. For example, the FontWeight property of a text box can be set to a number of values, including Bold , Normal , and ExTRa Light . Other expressions are strings, such as the Height and Width properties.

Report Designer aids us by setting property values to predefined constants. They remain constant while the report is being rendered.

The real power of expressions comes when these formerly static values can be changed while the report is processing to give the report a level of dynamism that it otherwise would not have had.

Suppose, for example, that you are generating a report of products and their profit and loss. One of the requirements of the report is to show the products that are losing money in big, bold, red letters . Profitability information is known in advance, not until a report pulls data from a data source. After data is retrieved, the report can use a simple expression logic =iif(Fields!ProductProfit.Value < 0, "Red", "Black") in the Color property of a text box to highlight negative values in Red .

Now on to the world of expressions...



Microsoft SQL Server 2005 Reporting Services
Microsoft SQL Server 2005 Reporting Services
ISBN: 0672327996
EAN: 2147483647
Year: 2004
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net