Recent Updates
Sphere of Care
Syndication
Reading/Listening
  • The Clarence Greenwood Recordings
    The Clarence Greenwood Recordings
    by Citizen Cope
  • Simple Genius
    Simple Genius
    by David Baldacci
Archives
« Passing Multi-value Parameters in a Drill-Through Report | Main | Multi-value List in Reporting Services 2005 »
Monday
12Jun2006

Listing All Values from a Mult-value Parameter in a Header or Footer

Our customer has numerous reports that allow multi-valued parameters.  Once these reports are exported and printed, the items they selected in the multi-value parameters are unknown to the recipient.

First, decide where your textbox containing the parameter list will be displayed.  We chose the footer as opposed to the header because when exporting to Excel, the header causes cells to merge incorrectly and makes the worksheet impossible to manipulate.

236778-362453-thumbnail.jpg
Fig. 1
Once the textbox has been placed in the header or footer, right click the textbox and select Expression.  In the Edit Expression dialog box we can automatically build an expression by selecting Parameter, <All>, then double clicking the multi-value parameter.

=Parameters!apnSym.Value(0)

Notice the (0) at the end of the expression.  This signifies that the parameter is a one-dimensional array.  All arrays in Reporting Services are zero-based so the index always begins with zero.  The second item in the array would be (1) and so on.

If the apnSym array had the following values: 0735, 1804, 1806, then the current expression would only return the first value and the textbox would contain a string of 0735.

236778-362477-thumbnail.jpg
Fig. 2
Fortunately, Reporting Services has functions to help you manipulate arrays.  The JOIN function can build a string list of values separated by a delimiter of your choice. 

We can edit directly in the Edit Expression dialog box.  Notice how Visual Studio helps you complete your expression by providing you with tool tips (Fig. 2).

=JOIN(Parameters!apnSym.Value, ",")

We remove the reference to the index of the array and use the JOIN function to build a string of values separated by a comma.  Therefore, the text box would contain the following string:

0735,1804,1806

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.