1250
Part IX: Business Intelligence
You can create parameters inside datasets built off of cubes as well. Going back to the
matrix report you created off of the Adventure Works cube, you can check the parameter
box inside the query designer as shown in Figure 55-7. This creates a hidden dataset that
the report uses for the parameter. You can see existing hidden datasets inside a project
by selecting Datasets in the Report Data pane, right clicking and selecting Show Hidden
Datasets.
FIGURE 55-7
Parameterizing a dataset built off of a cube.
For more information on working with parameters inside the Report Designer, see http://
msdn.microsoft.com/en-us/library/aa337432.aspx.
Working with RS Expressions
Anywhere inside the report designer you see a button with the Fx icon or a drop-down
list with Expression indicates that you can perform modifi cations with an expression.
Expressions in SSRS are visual basic code snippets that evaluate to a single value. Their
dynamic evaluations are used to change the properties of report elements. The dynamic
formatting accomplished at the beginning of this section was done with expressions. As
you saw, they can be used to change values and change text box properties, formatting
properties, and parameters; virtually any object inside a report can be confi gured using
expressions. Using visual basic as its base language, they can be extremely simple or
complex depending on your needs.
One common function used in reporting is the IIF statement, which accepts three
parameters: an expression, a true part (meaning what to return when the expression
evaluates to true) and a false part (what to return when the expression evaluates to
false). For instance, to format the detail rows on a report to alternate in color between
LightSteelBlue and no color, the following expression should be entered in the property box
expression for Background Color of the row:
= IIf(RowNumber(Nothing) Mod 2 = 0, "LightSteelBlue", "Transparent")
The logic of the expression can be interpreted as “if the RowNumber divided by 2 = 0
(meaning it’s an even numbered row), then the property (in this case the background color
of the row) equals LightSteelBlue; if it does not equal 0, then the background color equals
transparent. Nifty trick isn’t it?
For more information on using SSRS Expressions inside both Report Designer and Report
Builder 3.0 see Expression Uses in Reports (Report Builder 3.0 and SSRS) at http://msdn
.microsoft.com/en-us/library/ms345237(v=SQL.110).aspx.
c55.indd 1250c55.indd 1250 7/31/2012 10:28:06 AM7/31/2012 10:28:06 AM
http://www.it-ebooks.info