<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dutton Software &#187; Reporting Services</title>
	<atom:link href="http://www.duttonsoftware.com/tag/reporting-services/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.duttonsoftware.com</link>
	<description>Code, plug-ins &#38; more</description>
	<lastBuildDate>Mon, 16 Jan 2012 06:30:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Easy multi-value parameters in SQL Server Reporting Services</title>
		<link>http://www.duttonsoftware.com/2008/09/25/easy-multi-value-parameters-in-sql-server-reporting-services/</link>
		<comments>http://www.duttonsoftware.com/2008/09/25/easy-multi-value-parameters-in-sql-server-reporting-services/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 05:26:50 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[SQL Server Reporting Services]]></category>
		<category><![CDATA[Multi-value parameters]]></category>
		<category><![CDATA[Report parameters]]></category>
		<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://www.duttonsoftware.com/?p=19</guid>
		<description><![CDATA[I recently came across an application where I needed to use a multi-value parameter in SQL Server Reporting Services (SSRS). Â I always seemed to have trouble with these in the past. Â This time I found them very easy to use because I found (re-discovered?) a simple way. The basic idea is to set up a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came across an application where I needed to use a multi-value parameter in SQL Server Reporting Services (SSRS). Â I always seemed to have trouble with these in the past. Â This time I found them very easy to use because I found (re-discovered?) a simple way.</p>
<p>The basic idea is to set up a parameter as if it were going to be a single value parameter with the topmost row selected by default. Â I will walk through the steps of this scenario.</p>
<p>I chose the AdventureWorks database to do this sample and focused on June 2004 Sales to get an easy dataset to work with.</p>
<p>1. Create the basic dataset:</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/salesbyterritory-dataset.jpg"><img class="size-full wp-image-30 alignnone" title="salesbyterritory-dataset" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/salesbyterritory-dataset.jpg" alt="Sales By Territory Dataset" width="315" height="454" /></a></p>
<p>2. Set up the layout for the report:</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/june-2004-sales-by-territory-layout.jpg"><img class="alignnone size-full wp-image-22" title="june-2004-sales-by-territory-layout" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/june-2004-sales-by-territory-layout.jpg" alt="" width="500" height="247" /></a></p>
<p>3. Preview the report with no parameters:</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/june-2004-sales-by-territory-preview.jpg"><img class="alignnone size-full wp-image-23" title="june-2004-sales-by-territory-preview" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/june-2004-sales-by-territory-preview.jpg" alt="" width="372" height="468" /></a></p>
<p>4. Create a new dataset for the territories list:</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/terroritylist-dataset.jpg"><img class="alignnone size-full wp-image-33" title="terroritylist-dataset" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/terroritylist-dataset.jpg" alt="" width="299" height="434" /></a></p>
<p>5. Set up the parameter, <strong>TerritoryID</strong>, like a normal single-value parameter. Â Be sure to set the default value to make it default to the topmost row in the list. Â In this case, the topmost is &#8220;Australia&#8221;, TerritoryID of 9.</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-dialog-single-parameter.jpg"><img class="alignnone size-full wp-image-29" title="report-parameters-dialog-single-parameter" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-dialog-single-parameter.jpg" alt="" width="500" height="387" /></a></p>
<p>6a. Apply the filter to the table. Â Notice that I am not editing the dataset, but simply adding a filter to the table properties. Â If you are usually the type to edit the dataset (like myself), just hang with me for a second. Â Right-click the edge of the table and then choose <strong>Properties</strong>:</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/design-table-properties.jpg"><img class="alignnone size-full wp-image-21" title="design-table-properties" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/design-table-properties.jpg" alt="" width="394" height="414" /></a></p>
<p>6b. Â Modify the table properties to add the filter. Â Since you can&#8217;t read it all, it says</p>
<pre>=Fields!TerritoryID.Value = Parameters!TerritoryID.Value</pre>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/table-properties-applying-filter.jpg"><img class="alignnone size-full wp-image-31" title="table-properties-applying-filter" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/table-properties-applying-filter.jpg" alt="" width="448" height="432" /></a></p>
<p>7. Check the finished result. Â We now have a report with a single parameter. Â The topmost selection, Australia, is automatically selected and our filter is applied by default.</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/preview-single-parameter-and-filter-applied.jpg"><img class="alignnone size-full wp-image-34" title="preview-single-parameter-and-filter-applied" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/preview-single-parameter-and-filter-applied.jpg" alt="" width="377" height="300" /></a></p>
<p>8. So far, so good&#8211;there is nothing extraordinary about what we&#8217;ve done so far. Â Now, we simple make the parameter multi-value by changing the report parameters and checking the <strong>Multi-value</strong> box:</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-dialog-multi-value-checked.jpg"><img class="alignnone size-full wp-image-28" title="report-parameters-dialog-multi-value-checked" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-dialog-multi-value-checked.jpg" alt="" width="500" height="387" /></a></p>
<p>9. Don&#8217;t rush off just yet, or you&#8217;ll see this error message when you choose <strong>Preview</strong>:</p>
<address>An error occurred during local report processing.</address>
<address>An error has occurred during report processing.</address>
<address>The processing of FilterExpression for the table &#8216;Sales&#8217; cannot be performed. Cannot compare data of types System.Byte and System.Object[]. Â Please check the data type returned by the Filter Expression.<br />
</address>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/preview-rushing-into-errors.jpg"><img class="alignnone size-full wp-image-27" title="preview-rushing-into-errors" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/preview-rushing-into-errors.jpg" alt="" width="480" height="220" /></a></p>
<p>10. Â You need to make one small change to the filter. Â Open the table properties again, but this time change the operator from equals (=) to IN. Â Since the Parameters!TerritoryID.Value now contains a comma separated list, we need to search IN instead of comparing.</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/table-properties-applying-multi-value-filter.jpg"><img class="alignnone size-full wp-image-32" title="table-properties-applying-multi-value-filter" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/table-properties-applying-multi-value-filter.jpg" alt="" width="448" height="432" /></a></p>
<p>11. Now, preview your report. Â The left image shows the initial preview, the right image shows the drop-down list blown out, you can see that Select All is selected by default.</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/preview-multi-value-select-all-filter-applied.jpg"><img class="alignnone size-medium wp-image-25" title="preview-multi-value-select-all-filter-applied" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/preview-multi-value-select-all-filter-applied-275x300.jpg" alt="" width="275" height="300" /></a><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/preview-multi-value-select-all-filter-selected-by-default.jpg"><img class="alignnone size-medium wp-image-26" title="preview-multi-value-select-all-filter-selected-by-default" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/preview-multi-value-select-all-filter-selected-by-default-279x300.jpg" alt="" width="279" height="300" /></a></p>
<p>One caveat is that performance is not going to be top notch because Reporting Services is filtering on the entire dataset every time. Â It would (most likely, depending on your implementation) be faster to filter in the dataset. Â However, this approach often requires a lot of development work on the T-SQL side to get it working. Â This approach is easy and quick enough for many applications. Â Enjoy.</p>
<p>Update: I found a good example of <a href="http://www.eggheadcafe.com/software/aspnet/31022159/ssrs-multivalue-paramete.aspx" target="_blank">the hard way to do multi-value parameters (by using SQL)</a>. Â If you scroll down to the second post, there is source code there for converting a delimited string into a table variable. Â I have re-formatted the <a href="http://www.duttonsoftware.com/wp-content/uploads/2008/10/charlist_to_table.sql">charlist_to_table source code</a> to make it more legible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.duttonsoftware.com/2008/09/25/easy-multi-value-parameters-in-sql-server-reporting-services/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>CAML queries, SSRS, and datetime fields</title>
		<link>http://www.duttonsoftware.com/2008/09/24/caml-queries-ssrs-and-datetime-fields/</link>
		<comments>http://www.duttonsoftware.com/2008/09/24/caml-queries-ssrs-and-datetime-fields/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 06:45:46 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[SQL Server Reporting Services]]></category>
		<category><![CDATA[WSS 3.0]]></category>
		<category><![CDATA[CAML]]></category>
		<category><![CDATA[DateTime]]></category>
		<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://www.duttonsoftware.com/?p=12</guid>
		<description><![CDATA[I&#8217;ve been using Enesys Software&#8217;s product RS Data Extension to query data out of SharePoint 2007 lists in SQL Server (2005) Reporting Services.  One quirk with the queries is that they use CAML and the dates must be in a particular format, ISO8601. I wanted users to use the standard date-picker, but there is no [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Enesys Software&#8217;s product <a title="RS Data Extension" href="http://www.enesyssoftware.com/Products/EnesysRSDataExtension/Overview/tabid/72/language/en-US/Default.aspx" target="_blank">RS Data Extension</a> to query data out of SharePoint 2007 lists in SQL Server (2005) Reporting Services.  One quirk with the queries is that they use CAML and the dates must be in a particular format, ISO8601.</p>
<p>I wanted users to use the standard date-picker, but there is no way to format the date inside the query.  My work-around is a classic Reporting Services pattern &#8211; create an internal parameter that does the formatting for you.  The format string for VBScript is &#8220;yyyy-MM-ddTHH:mm:ss&#8221;.</p>
<p>Below is a screenshot of the Report Parameters dialog. I used the following code to just grab today&#8217;s date (no time).</p>
<pre>     =CDate(CDate(Now()).ToString(<span style="color: #993300;">"MM/dd/yyyy"</span>))</pre>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-start-date.jpg"><img class="alignnone size-full wp-image-17" title="report-parameters-start-date" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-start-date.jpg" alt="" width="500" height="387" /></a></p>
<p>For the second parameter, I create an internal parameter that is dependent on the first.  This will prevent it from showing on the report and it will not be filled in until the start date is chosen.  Default value:</p>
<pre>     =CDate(Parameters!StartDate.Value).ToString(<span style="color: #993300;">"yyyy-MM-ddTHH:mm:ss"</span>)</pre>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-iso8601-start-date.jpg"><img class="alignnone size-full wp-image-15" title="report-parameters-iso8601-start-date" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-iso8601-start-date.jpg" alt="" width="500" height="387" /></a></p>
<p>I created a test report to show how this works.  Here is the report definition:</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-definition.jpg"><img class="alignleft size-full wp-image-14" title="report-parameters-definition" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-definition.jpg" alt="" width="406" height="152" /></a></p>
<p>Below is the report preview:  You can now use the parameter in your CAML query.</p>
<p><a href="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-preview.jpg"><img class="alignnone size-full wp-image-16" title="report-parameters-preview" src="http://www.duttonsoftware.com/wp-content/uploads/2008/09/report-parameters-preview.jpg" alt="" width="351" height="203" /></a></p>
<p>One other note on CAML date fields.  The time is ignored by default.  If you want to include the time, you must specify another attribute.  Example:</p>
<pre>&lt;Geq&gt;</pre>
<pre style="padding-left: 30px;">&lt;FieldRef Name="LastModified" /&gt;</pre>
<pre style="padding-left: 30px;">&lt;Value Type="DateTime" IncludeTimeValue="TRUE"&gt;@LastModified!&lt;/Value&gt;</pre>
<pre>&lt;/Geq&gt;</pre>
<p>I found a helpful post on <a title="CAML &amp; DateTime" href="http://abstractspaces.wordpress.com/2008/05/05/caml-datetime/" target="_blank">CAML &amp; DateTime</a> that might be useful for you too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.duttonsoftware.com/2008/09/24/caml-queries-ssrs-and-datetime-fields/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

