<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>BI: Beer Intelligence?</title>
	
	<link>http://blog.hoegaerden.be</link>
	<description>Serving you my best brews, one pint at a time!</description>
	<lastBuildDate>Thu, 13 Jun 2013 16:01:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/BiBeerIntelligence" /><feedburner:info uri="bibeerintelligence" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Formatting Numbers [SSRS]</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/W_-uNx7lvcE/</link>
		<comments>http://blog.hoegaerden.be/2013/06/12/formatting-numbers-ssrs/#comments</comments>
		<pubDate>Wed, 12 Jun 2013 18:56:49 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[articles]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/06/12/formatting-numbers-ssrs/</guid>
		<description><![CDATA[On the forums I frequently encounter questions related to formatting certain things for display in a Reporting Services report. Formatting questions can be quite broad.&#160; Here are some examples to give you an idea: How do I convert a datetime to a specific string format? How do I display an amount with a currency symbol [...]]]></description>
			<content:encoded><![CDATA[<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="The Matrix Numbers" border="0" alt="The Matrix Numbers" align="right" src="http://blog.hoegaerden.be/wp-content/uploads/image618.png" width="286" height="214" />On the forums I frequently encounter questions related to formatting certain things for display in a Reporting Services report.</p>
<p>Formatting questions can be quite broad.&#160; Here are some examples to give you an idea:</p>
<blockquote><p>How do I convert a datetime to a specific string format?</p>
<p>How do I display an amount with a currency symbol and thousands separator?</p>
<p>How can I display a percentage with 4 positions following the decimal separator?</p>
</blockquote>
<p>The internet does have some information available on formatting.&#160; However, this info is spread over several different pages and to be able to find it you need to be aware of a couple of things.&#160; Which is why I decided to write an article that&#8217;s dedicated 100% to the topic of formatting stuff in SSRS reports so I can refer to it when applicable.</p>
<h2>Introduction</h2>
<p>Basically you&#8217;ve got two options when formatting.&#160; The first one is using the <strong>Format</strong> property, which is one of the properties of the <strong>Textbox</strong>.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="The Format property" border="0" alt="The Format property" src="http://blog.hoegaerden.be/wp-content/uploads/image600.png" width="315" height="221" /></p>
<p>Or you can decide to not use the Format property at all and write a custom expression that uses some formatting functions to create the value string.&#160; I&#8217;ll explain both in combination with all applicable data types.</p>
<p>You should also be aware that the formatting functionality is not specific for SSRS only.&#160; If you&#8217;ve got some development experience you&#8217;ll probably recognize some syntax.&#160; SSRS is actually just a layer on top of the .NET framework, as far as formatting is concerned.&#160; So in many cases you&#8217;ll find interesting info online by searching in the .NET documentation.&#160; I&#8217;ll be referring to several .NET-related pages in the text below.</p>
<h2>The Query</h2>
<p>As with any good report, before we can display anything we first need to write a SQL query.&#160; My data source is the AdventureWorksDW2012 sample database, <a title="CodePlex" href="http://msftdbprodsamples.codeplex.com/" target="_blank">available at CodePlex</a>.</p>
<p>And here’s the query:</p>
<pre class="code"><span style="color: blue">SELECT </span><span style="color: teal">dd</span><span style="color: gray">.</span><span style="color: teal">FullDateAlternateKey </span><span style="color: blue">as </span><span style="color: teal">OrderDate
      </span><span style="color: gray">, </span><span style="color: teal">f</span><span style="color: gray">.</span><span style="color: teal">SalesOrderNumber
      </span><span style="color: gray">, </span><span style="color: teal">f</span><span style="color: gray">.</span><span style="color: teal">SalesOrderLineNumber
      </span><span style="color: gray">, </span><span style="color: teal">f</span><span style="color: gray">.</span><span style="color: teal">OrderQuantity </span><span style="color: gray">* </span>42000 <span style="color: blue">as </span><span style="color: teal">OrderQuantity
      </span><span style="color: gray">, </span><span style="color: teal">f</span><span style="color: gray">.</span><span style="color: teal">UnitPriceDiscountPct
      </span><span style="color: gray">, </span><span style="color: teal">f</span><span style="color: gray">.</span><span style="color: teal">SalesAmount
      </span><span style="color: gray">, </span><span style="color: teal">dc</span><span style="color: gray">.</span><span style="color: teal">CurrencyAlternateKey </span><span style="color: blue">as </span><span style="color: teal">CurrencyISO
</span><span style="color: blue">FROM </span><span style="color: teal">dbo</span><span style="color: gray">.</span><span style="color: teal">FactResellerSales f
</span><span style="color: gray">inner join </span><span style="color: teal">dbo</span><span style="color: gray">.</span><span style="color: teal">DimCurrency dc </span><span style="color: blue">on </span><span style="color: teal">dc</span><span style="color: gray">.</span><span style="color: teal">CurrencyKey </span><span style="color: gray">= </span><span style="color: teal">f</span><span style="color: gray">.</span><span style="color: teal">CurrencyKey
</span><span style="color: gray">inner join </span><span style="color: teal">dbo</span><span style="color: gray">.</span><span style="color: teal">DimDate dd </span><span style="color: blue">on </span><span style="color: teal">dd</span><span style="color: gray">.</span><span style="color: teal">DateKey </span><span style="color: gray">= </span><span style="color: teal">f</span><span style="color: gray">.</span><span style="color: teal">OrderDateKey
</span><span style="color: blue">where </span><span style="color: teal">UnitPriceDiscountPct </span><span style="color: gray">&gt; </span>0</pre>
<p><em>Little sidenote: I&#8217;m multiplying OrderQuantity with 42000 to get larger numbers to be able to demonstrate certain things, such as the thousands separator.&#160; Don&#8217;t do that in the production version!</em></p>
<h2>Formatting Numbers</h2>
<h3>Regular Numbers</h3>
<p>Let&#8217;s start with the easiest of them all: the regular numbers.&#160; Without any formatting specified, numbers are rendered without any &quot;make up&quot;, similar to how the Management Studio shows them in the query Results window.&#160; For a report that&#8217;s usually not what we prefer.</p>
<p>I mentioned the Format property earlier.&#160; Now the question of the day is: what can you put in there to format a number differently?&#160; There are some <a title="Standard Numeric Format Strings" href="http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx" target="_blank">standard format strings</a> that can be used.&#160; Here&#8217;s one: type an <strong>N</strong> in the Format property of a Textbox that displays the OrderQuantity.&#160; When rendering the report you&#8217;ll get a number with a thousands separator and two decimal positions:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Formatting a number using standard format string" border="0" alt="Formatting a number using standard format string" src="http://blog.hoegaerden.be/wp-content/uploads/image601.png" width="216" height="121" /></p>
<p>What if we don&#8217;t want any decimals?&#160; Or what if we actually want to display four instead of two?&#160; No problem, precision can be specified by just adding a trailing zero or four to the N specifier: N0 or N4.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Formatting numbers while specifying number of decimal positions" border="0" alt="Formatting numbers while specifying number of decimal positions" src="http://blog.hoegaerden.be/wp-content/uploads/image602.png" width="312" height="141" /></p>
<p>The standard format strings are useful but not very flexible.&#160; If you need more flexibility then there are some <a title="Custom Numeric Format Strings" href="http://msdn.microsoft.com/en-us/library/0c899ak8.aspx" target="_blank">custom format strings</a> to be used.&#160; In that case the equivalent of N0 would be #,###.&#160; Here are some more:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Formatting numbers using the custom format string" border="0" alt="Formatting numbers using the custom format string" src="http://blog.hoegaerden.be/wp-content/uploads/image603.png" width="497" height="229" /></p>
<p>The double comma that you see in the #,#,,.# example is called the <em>number scaling specifier</em>.&#160; As you can see, for each instance of that specifier the number gets divided by 1000.&#160; This is a very useful method when you want to use minimal space such as in charts.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Using the number scaling specifier to minimize space usage" border="0" alt="Using the number scaling specifier to minimize space usage" src="http://blog.hoegaerden.be/wp-content/uploads/image604.png" width="291" height="154" /></p>
<p>With that knowledge we can even take it one step further!&#160; (Get a coffee if you haven&#8217;t already.)</p>
<p>Let&#8217;s first create a calculated field called <em>NumberFormat</em> using the following expression:</p>
<pre class="code">=Switch(
    Fields!SalesAmount.Value &lt; 1000, <span style="color: #a31515">&quot;0.#&quot;</span>,
    Fields!SalesAmount.Value &lt; 1000000, <span style="color: #a31515">&quot;#,.#K&quot;</span>,
    <span style="color: blue">true</span>, <span style="color: #a31515">&quot;#,,M&quot;</span>)</pre>
<p>
  <br />Now that we&#8217;ve got that field we can use an expression like this:</p>
<p></p>
<pre class="code">=Format(Fields!SalesAmount.Value, Fields!NumberFormat.Value)</pre>
<p><em>Note: the Format function in use here is explained a bit further down.</em></p>
<p>Here&#8217;s what that would look like in a table:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Using the number scaling specifier" border="0" alt="Using the number scaling specifier" src="http://blog.hoegaerden.be/wp-content/uploads/image605.png" width="222" height="182" /></p>
<p>If you want to specify a different format for negative numbers, don&#8217;t worry, can be done as well.&#160; Just enter two custom format strings separated with a semi-colon:<strong> #,###;(#,###)</strong>.&#160; And the same for zero values, add another semi-colon and format string at the end: <strong>#,###;(#,###);&#8217;-&#8217;</strong>:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Specifying a different format for negative or zero values" border="0" alt="Specifying a different format for negative or zero values" src="http://blog.hoegaerden.be/wp-content/uploads/image606.png" width="199" height="58" /></p>
<p>Can you achieve the same without using the Format property?&#160; Sure, as I mentioned in the intro you can also make use of some functions when displaying the value.&#160; One of the functions that can be used is called <strong>FormatNumber</strong>:</p>
<blockquote>
<p>Function FormatNumber(</p>
<p>ByVal Expression As Object,</p>
<p>Optional ByVal NumDigitsAfterDecimal As Integer = -1,</p>
<p>Optional ByVal IncludeLeadingDigit As TriState = TriState.UseDefault,</p>
<p>Optional ByVal UseParensForNegativeNumbers As TriState = TriState.UseDefault,</p>
<p>Optional ByVal GroupDigits As TriState = TriState.UseDefault</p>
<p>) As String</p>
</blockquote>
<p><em>NumDigitsAfterDecimal</em> is used to specify precision.</p>
<p><em>IncludeLeadingDigit</em> has an effect on numbers smaller than one. When set to True 0.6 will render as 0.6 while that will become .6 when set to False.</p>
<p><em>UseParensForNegativeNumbers</em> will render parentheses around negative values when set to True, otherwise you&#8217;ll get a leading dash: (5) or -5.</p>
<p><em>GroupDigits</em> indicates if the thousands separator should be rendered.</p>
<p>To give that a try, replace the =Fields!OrderQuantity.Value with this expression:</p>
<pre class="code">=FormatNumber(Fields!OrderQuantity.Value, 3, <span style="color: blue">True</span>, <span style="color: blue">True</span>, <span style="color: blue">True</span>)</pre>
<p>Here’s what that looks like when rendered:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Using the FormatNumber function" border="0" alt="Using the FormatNumber function" src="http://blog.hoegaerden.be/wp-content/uploads/image607.png" width="240" height="146" /></p>
<p>There&#8217;s something you do need to take into consideration though.&#160; Take a good look at the above screenshot and compare it with some of the other ones shown earlier.&#160; Do you see the horizontal alignment difference? The <a title="FormatNumber Function (Visual Basic)" href="http://msdn.microsoft.com/en-us/library/xfta99yt(v=vs.90).aspx" target="_blank">FormatNumber</a> function actually returns a string while the formatting options through the Format property keep the value numeric and thus aligned right.&#160; That has an effect on the export to Excel, so you may want to experiment a little before delving into using custom expressions.</p>
<p>Another really useful function is called <strong>Format</strong>. Here&#8217;s what it looks like:</p>
<blockquote>
<p>Public Shared Function Format( _</p>
<p>ByVal Expression As Object, _</p>
<p>Optional ByVal Style As String = &quot;&quot; _</p>
<p>) As String</p>
</blockquote>
<p>It works very similar to the Format property: any valid format string in the Format property will also be a valid string to be passed into the <em>Style</em> parameter of the <a title="Format Function" href="http://msdn.microsoft.com/en-us/library/59bz1f0h(v=vs.90).aspx" target="_blank">Format</a> function.</p>
<p><em><span style="text-decoration: underline">Sidenote:</span></em> if you&#8217;re looking for the MSDN page on a certain function but can&#8217;t find it, try this.&#160; First locate the function in the Expression builder:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image608.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Locating the Format function in the Expression builder" border="0" alt="Locating the Format function in the Expression builder" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb113.png" width="700" height="333" /></a></p>
<p>Then enter the function name followed by the description (or part of it) surrounded with double quotes into the search box of your favorite engine:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="How to find a function description" border="0" alt="How to find a function description" src="http://blog.hoegaerden.be/wp-content/uploads/image609.png" width="527" height="482" /></p>
<p><a title="Format Function" href="http://msdn.microsoft.com/en-us/library/59bz1f0h(v=vs.90).aspx" target="_blank">Reference page found!</a></p>
<h3>Leading Zeroes</h3>
<p>What if you want your number to display leading zeroes?&#160; That can be achieved by using another standard numeric string formatter: <strong>D</strong>.&#160; Try using <strong>D10</strong> on the SalesOrderLineNumber:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Formatting numbers with leading zeroes" border="0" alt="Formatting numbers with leading zeroes" src="http://blog.hoegaerden.be/wp-content/uploads/image610.png" width="220" height="170" /></p>
<p>There you go, leading zeroes!</p>
<h3>Currency Amounts</h3>
<p>With regular numbers covered, let&#8217;s switch to currency values.&#160; The standard format string for currency amounts is <strong>C</strong>.&#160; When specified, the currency amount will be rendered with a leading currency symbol, a space, thousands separator and two decimal positions.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Using the standard format string for currency amounts" border="0" alt="Using the standard format string for currency amounts" src="http://blog.hoegaerden.be/wp-content/uploads/image611.png" width="234" height="167" /></p>
<p>The symbol that&#8217;s used depends on the report&#8217;s <strong>Language</strong> property unless that property is not set.&#160; I&#8217;m not going into localization issues now so have a look at following page for more info if needed: <a title="Set the Locale for a Report or Text Box (Reporting Services)" href="http://technet.microsoft.com/en-us/library/ms159642.aspx" target="_blank">Set the Locale for a Report or Text Box (Reporting Services)</a></p>
<p>Can you use a custom format string for currency amounts?&#160; Sure, here&#8217;s what it looks like: <strong>&#8216;€ &#8216;#,#</strong>.&#160; You actually hard-code the currency symbol into the format string.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Using a custom format string for currency amounts" border="0" alt="Using a custom format string for currency amounts" src="http://blog.hoegaerden.be/wp-content/uploads/image612.png" width="229" height="167" /></p>
<p>BTW: those single quotes are optional, you’d get the same result if you leave them out.</p>
<p>Formatting currency values through expressions is possible as well.&#160; The function specifically created for this is called <strong>FormatCurrency</strong>:</p>
<blockquote>
<p>Function FormatCurrency(</p>
<p>ByVal Expression As Object,</p>
<p>Optional ByVal NumDigitsAfterDecimal As Integer = -1,</p>
<p>Optional ByVal IncludeLeadingDigit As TriState = TriState.UseDefault,</p>
<p>Optional ByVal UseParensForNegativeNumbers As TriState = TriState.UseDefault,</p>
<p>Optional ByVal GroupDigits As TriState = TriState.UseDefault</p>
<p>) As String</p>
</blockquote>
<p>As you can see it is very similar to the FormatNumber function.&#160; The only difference is that it will generate a number with a leading currency symbol.</p>
<p>So what if your data consists of mixed currencies?&#160; In that case the <a title="FormatCurrency Function (Visual Basic)" href="http://msdn.microsoft.com/en-us/library/3352e6f5(v=vs.90).aspx" target="_blank">FormatCurrency</a> function is not very useful.&#160; But it can be done!&#160; Let&#8217;s demonstrate this using the SalesAmount and the CurrencyISO fields.&#160; In our sample data the CurrencyISO field contains the three-letter ISO code of the currency.</p>
<p>The reference data, a list of currencies accompanied by their symbol, should be available in a database somewhere.&#160; For demonstration purposes I&#8217;ll create a new dataset called Currencies using the query below.&#160; So just imagine it comes from a table. <img src='http://blog.hoegaerden.be/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="code"><span style="color: blue">select </span><span style="color: red">'USD' </span><span style="color: teal">CurrencyISOCode</span><span style="color: gray">, </span><span style="color: red">'$' </span><span style="color: teal">Symbol
</span><span style="color: blue">union </span><span style="color: gray">all </span><span style="color: blue">select </span><span style="color: red">'EUR'</span><span style="color: gray">, </span><span style="color: red">'€'
</span><span style="color: blue">union </span><span style="color: gray">all </span><span style="color: blue">select </span><span style="color: red">'CAD'</span><span style="color: gray">, </span><span style="color: red">'$'
</span><span style="color: blue">union </span><span style="color: gray">all </span><span style="color: blue">select </span><span style="color: red">'GBP'</span><span style="color: gray">, </span><span style="color: red">'£'
</span></pre>
<p>
  <br />We can now use the <a title="Looking Up Data On Different Sources" href="http://blog.hoegaerden.be/2010/05/16/looking-up-data-on-different-sources/" target="_blank">Lookup function</a> to retrieve the symbol that belongs to the currency ISO code.&#160; Here&#8217;s what that would look like:</p>
<p></p>
<pre class="code">=Lookup(Fields!CurrencyISO.Value, Fields!CurrencyISOCode.Value, Fields!Symbol.Value, <span style="color: #a31515">&quot;Currencies&quot;</span>)
    &amp; <span style="color: #a31515">&quot; &quot; </span>&amp; Format(Fields!SalesAmount.Value, <span style="color: #a31515">&quot;#,0.00&quot;</span>)</pre>
<p>The expression above would give us following output:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Mixed currencies using correct symbol through lookup on different dataset" border="0" alt="Mixed currencies using correct symbol through lookup on different dataset" src="http://blog.hoegaerden.be/wp-content/uploads/image613.png" width="343" height="342" /></p>
<h3>Percentages</h3>
<p>Let&#8217;s conclude this article by displaying some percentages.&#160; We&#8217;ll create a new dataset for that:</p>
<pre class="code"><span style="color: blue">select </span>0.33 <span style="color: teal">Pct
</span><span style="color: blue">union </span><span style="color: gray">all </span><span style="color: blue">select </span>1.5
<span style="color: blue">union </span><span style="color: gray">all </span><span style="color: blue">select </span>0.0045
<span style="color: blue">union </span><span style="color: gray">all </span><span style="color: blue">select </span>42</pre>
<p>Once more we&#8217;ve got a standard format string that can be used.&#160; Here&#8217;s what it looks like if we put this Pct field in a table.&#160; The left column is not formatted while the right has got the standard <strong>P</strong> formatter in the <strong>Format</strong> property:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Formatting percentages with the standard P string" border="0" alt="Formatting percentages with the standard P string" src="http://blog.hoegaerden.be/wp-content/uploads/image614.png" width="208" height="104" /></p>
<p>Without any precision specified the <strong>P</strong> formatter uses two positions following the decimal separator, just like we&#8217;ve seen earlier.&#160; And we get a space followed by the percentage symbol added to the end of the number.</p>
<p>But what&#8217;s really important to note and differs from regular numbers is that the P formatter will actually multiply the value by 100!&#160; That means percentages from 0 to 100 need to be stored in the 0 to 1 range.&#160; Don&#8217;t forget to take that into account or your reports won&#8217;t make much sense.</p>
<p>Another option to get this percentage formatted is through using <strong><a title="FormatPercent Function (Visual Basic)" href="http://msdn.microsoft.com/en-us/library/8zh1kxd7(v=vs.90).aspx" target="_blank">FormatPercent</a></strong> function:</p>
<blockquote>
<p>public static string FormatPercent(</p>
<p>Object Expression,</p>
<p>int NumDigitsAfterDecimal,</p>
<p>TriState IncludeLeadingDigit,</p>
<p>TriState UseParensForNegativeNumbers,</p>
<p>TriState GroupDigits</p>
<p>)</p>
</blockquote>
<p>As it&#8217;s very similar to other functions mentioned above I won&#8217;t go into much detail here.&#160; Try the following expression:</p>
<pre class="code">=FormatPercent(Fields!Pct.Value, 1)</pre>
<p>And here&#8217;s its result:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Formatting with the FormatPercent function" border="0" alt="Formatting with the FormatPercent function" src="http://blog.hoegaerden.be/wp-content/uploads/image615.png" width="204" height="100" /></p>
<p>If you need more flexibility have a look at the<strong> %</strong> symbol in following format string: <strong>#,0.00%</strong></p>
<p>Result:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Formatting percentages through custom string" border="0" alt="Formatting percentages through custom string" src="http://blog.hoegaerden.be/wp-content/uploads/image616.png" width="205" height="106" /></p>
<p>If you need per mille then then you’ll need to use the per mille sign: <strong>#,0.00‰</strong></p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="The per mille formatter" border="0" alt="The per mille formatter" src="http://blog.hoegaerden.be/wp-content/uploads/image617.png" width="203" height="101" /></p>
<p>Notice how the per mille symbol multiplies the value by 1000, don&#8217;t forget to take it into account!</p>
<p><em>Tip: if you don’t know how to type that symbol, simply copy it from my expression above.</em></p>
<h2>Conclusion</h2>
<p>In this article I&#8217;ve explained practically all different options to get your numbers formatted the way you&#8217;d like to.</p>
<p>Keep your eyes open for the next chapter in which I&#8217;ll handle even more formatting, such as for dates and times.</p>
<p>In the meantime: happy formatting!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F06%2F12%2Fformatting-numbers-ssrs%2F&amp;title=Formatting%20Numbers%20%5BSSRS%5D" id="wpa2a_2"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=W_-uNx7lvcE:Z6h4gmhUsjI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=W_-uNx7lvcE:Z6h4gmhUsjI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=W_-uNx7lvcE:Z6h4gmhUsjI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=W_-uNx7lvcE:Z6h4gmhUsjI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=W_-uNx7lvcE:Z6h4gmhUsjI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=W_-uNx7lvcE:Z6h4gmhUsjI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=W_-uNx7lvcE:Z6h4gmhUsjI:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=W_-uNx7lvcE:Z6h4gmhUsjI:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=W_-uNx7lvcE:Z6h4gmhUsjI:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/W_-uNx7lvcE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/06/12/formatting-numbers-ssrs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/06/12/formatting-numbers-ssrs/</feedburner:origLink></item>
		<item>
		<title>Community Day 2013: Data Visualization Tips &amp; Tricks</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/Vc9b19UD8gw/</link>
		<comments>http://blog.hoegaerden.be/2013/05/29/community-day-2013-data-visualization-tips-tricks/#comments</comments>
		<pubDate>Wed, 29 May 2013 14:59:07 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Community Event]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[SQLUG]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/05/29/community-day-2013-data-visualization-tips-tricks/</guid>
		<description><![CDATA[In case you’ve never heard of Community Day, despite that it’s the largest Belgian community event of the year, it’s an event in which several user groups join forces to provide a nice learning experience to the attendees. The participating user groups this year are VISUG, AZUG, Belgian C++ user group, BIWUG, CLUG, Pro-Exchange, SCUG, [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Community Day 2013" href="http://www.communityday.be/" target="_blank"><img style="background-image: none; margin: 0px 0px 5px 6px; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border: 0px;" src="http://www.communityday.be/Portals/_default/Skins/ComDay/images/comdaymainlogo.png" border="0" alt="" width="435" height="141" align="right" /></a>In case you’ve never heard of <strong>Community Day</strong>, despite that it’s the largest Belgian community event of the year, it’s an event in which several user groups join forces to provide a nice learning experience to the attendees.</p>
<p>The participating user groups this year are VISUG, AZUG, Belgian C++ user group, BIWUG, CLUG, Pro-Exchange, SCUG, SQLUG, ACCB.net/VBIB, WinTalks, DotNetHub, MADN, TechNine, IAMCT and PHP Benelux.</p>
<p>And guess what: I’m a speaker! My colleague <a title="Koen Verbeeck's blog" href="http://blogs.lessthandot.com/index.php?disp=authdir&amp;author=940" target="_blank">Koen Verbeeck</a> and myself have <a title="SQLUG: Automating SSRS Deployments" href="http://blog.hoegaerden.be/2013/01/21/sqlug-automating-ssrs-deployments/" target="_blank">once more</a> decided to share a presenting slot that day.  And we’ll be sharing some <a title="Data Visualization Tips &amp; Tricks" href="http://www.communityday.be/Sessionabstracts/tabid/233/Default.aspx#Session3" target="_blank"><strong>Data Visualization Tips &amp; Tricks</strong></a> with you!</p>
<p>Koen will be talking about how to best visualize data: should I use a pie chart or would a bar chart provide a more interesting result, is it really a good idea to use red and green, that kind of stuff.</p>
<p>When he’s finished I’ll be taking over to show you some cool things you can do with SQL Server Reporting Services.  Yes, that’s lots of demos and practically no slides!  Cool?</p>
<p>The expected level is 300.  Don’t worry though, we know that the Community Day crowd consists mainly of developers so we’ll be taking that into account.</p>
<p>Ow, and <strong>I’m accepting topic suggestions</strong>! If you’ve been wondering about how to get something visualized but never got it to work, don’t hesitate to contact me by either posting a comment here or through email (found on my <a title="About Me" href="http://blog.hoegaerden.be/about/" target="_blank">About</a> page).  Provide a clear description of what you’d like to achieve, with a mock-up example if needed.  I’ll be selecting the most interesting proposals to fill some minutes with. Looking forward to some useful suggestions! <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://blog.hoegaerden.be/wp-content/uploads/wlEmoticon-smile7.png" alt="Smile" /></p>
<p>More details about Community Day:</p>
<ul>
<li>Utopolis Mechelen, Spuibeekstraat 5, 2800 Mechelen</li>
<li>June 20th 2013, 0830 &#8211; 1900</li>
<li>Twitter: @ComDayBe</li>
<li>Five tracks!</li>
</ul>
<p>What are you waiting for? <a title="Community Day Registration" href="http://www.communityday.be/cd/tabid/58/Default.aspx" target="_blank">Register now</a> before all seats are taken!</p>
<p>See you there and in the meantime: have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F05%2F29%2Fcommunity-day-2013-data-visualization-tips-tricks%2F&amp;title=Community%20Day%202013%3A%20Data%20Visualization%20Tips%20%26%20Tricks" id="wpa2a_4"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=Vc9b19UD8gw:1ae8xQAVuKU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=Vc9b19UD8gw:1ae8xQAVuKU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=Vc9b19UD8gw:1ae8xQAVuKU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=Vc9b19UD8gw:1ae8xQAVuKU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=Vc9b19UD8gw:1ae8xQAVuKU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=Vc9b19UD8gw:1ae8xQAVuKU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=Vc9b19UD8gw:1ae8xQAVuKU:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=Vc9b19UD8gw:1ae8xQAVuKU:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=Vc9b19UD8gw:1ae8xQAVuKU:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/Vc9b19UD8gw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/05/29/community-day-2013-data-visualization-tips-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/05/29/community-day-2013-data-visualization-tips-tricks/</feedburner:origLink></item>
		<item>
		<title>T-SQL Tuesday 42: Life, Change, Don’t Panic!</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/xwVJPPLyGnk/</link>
		<comments>http://blog.hoegaerden.be/2013/05/14/t-sql-tuesday-42-life-change-dont-panic/#comments</comments>
		<pubDate>Tue, 14 May 2013 17:04:18 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[TSQL2sday]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/05/14/t-sql-tuesday-42-life-change-dont-panic/</guid>
		<description><![CDATA[Look at that, it&#8217;s T-SQL Tuesday #42, how can I miss that?! This month&#8217;s party is hosted by Wendy Pastrick and the topic is about change in the work life, possibly related to technology.&#160; Well yeah, in my career of approximately fifteen years now I can write a couple of words on that subject.&#160; Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><a title="It&#39;s time for T-SQLTuesday #42! The Long and Winding Road" href="http://wendyverse.blogspot.be/2013/05/its-time-for-t-sqltuesday-42-long-and.html" target="_blank"><img style="display: inline; float: right" align="right" src="http://2.bp.blogspot.com/-1R62dUj_zYU/UYgATm2KNjI/AAAAAAAAAK0/Nxnc_O8IUJY/s1600/TSQL2sDay150x150.jpg" /></a>Look at that, it&#8217;s T-SQL Tuesday #42, how can I miss that?!</p>
<p>This month&#8217;s party is hosted by <a title="It&#39;s time for T-SQLTuesday #42! The Long and Winding Road" href="http://wendyverse.blogspot.com/2013/05/its-time-for-t-sqltuesday-42-long-and.html" target="_blank">Wendy Pastrick</a> and the topic is about change in the work life, possibly related to technology.&#160; Well yeah, in my career of approximately fifteen years now I can write a couple of words on that subject.&#160; Here&#8217;s the story of my career.</p>
<h2>Introduction</h2>
<p>For those who don&#8217;t know me yet I have something to confess: I used to be a software developer!&#160; And I&#8217;m not ashamed to admit this.&#160; Perhaps not that surprising, fifteen years ago you didn&#8217;t finish your studies to conclude: <em>&quot;And now I&#8217;m going to be a Business Intelligence consultant!&quot;</em>.&#160; Oh no, not at all.</p>
<p>During my studies, out of all possibilities, I already knew what I liked most: to develop software.&#160; And I also quickly learned that my favorite language would not be COBOL, too outdated.&#160; It wouldn&#8217;t be Visual Basic either, feels like you&#8217;re writing a book.&#160; I prefer the shorter C/C++ syntax style.&#160; I also knew that I didn&#8217;t want a consultancy position.&#160; I considered a consultant to be an expert, and how could I be an expert after just having finished my studies??</p>
<h3>Change 1.1</h3>
<p>The first three years of my career I was an in-house C++ programmer.&#160; Then I got involved with a software package that was written in VB6.&#160; They were lacking manpower to implement new functionality and I was asked to help out.&#160; So I did some programming in VB6 because there was no other option.</p>
<p>Then the first version of .NET arrived and guess what I did?&#160; Part of the package&#8217;s functionality was the import of data out of flat files.&#160; My job was to automate this process.&#160; SSIS would have been perfect for the job but that didn&#8217;t exist yet.&#160; I did use DTS for a couple of things, but not here.&#160; The existing code consisted of about 15,000 lines of VB6 code which means redesigning was not an option anyway.&#160; So I wrote a Windows service in C# that called the VB6 code!&#160; Process automated!</p>
<h3>Change 1.2</h3>
<p>I&#8217;d also been using C# to write a couple of tools to help me in my day-to-day job.&#160; Then the opportunity arose to be part of a new project which would be written completely in C#.&#160; I was happy to be part of this!&#160; Compared with VB6 and VC++6, the new Visual Studio for .NET was really a joy to work with!</p>
<h3>Change 1.3</h3>
<p>After a good year or so, upper management decided to go on the free tour: instead of .NET we were required to use Java for any new development projects.&#160; Sure, why not give that a try then?!&#160; One of the subprojects on which I worked was an activity monitoring tool for our server application.&#160; I ended up developing some stored procedures to extract statistics out of logging tables.&#160; At that time I wasn&#8217;t familiar with the ETL acronym yet, but that&#8217;s what I was doing.&#160; Nowadays I would use SSIS for such a task.&#160; There was also a reporting part to the project so I coded a website, in Java, to display those numbers, with drill through functionality and all that fancy stuff.&#160; Nowadays I would definitely use SSRS!</p>
<p>Several months and lots of code later I realized that I didn&#8217;t enjoy Java (and all involved tools, libraries, &#8230;) as much as I enjoyed C#.&#160; Sure, I could get stuff done.&#160; But it wasn&#8217;t always as straightforward as I would have hoped, and online info was not as good &#8211; in my opinion.</p>
<p>After ten years of being an in-house developer at three different companies, I decided the time had come for a bigger change!&#160; What I haven&#8217;t mentioned so far is that practically all projects in which I was involved used SQL Server as database engine.&#160; And I always enjoyed playing around with that.</p>
<h3>Change 2.0</h3>
<p>In my new job I would no longer be an in-house employee and my main activity wouldn&#8217;t be writing code: I became a <strong>SQL Server Business Intelligence Consultant</strong>!</p>
<p>My employer, <a title="Ordina" href="http://www.ordina.be" target="_blank">Ordina</a>, gave me some time to cope with the change.&#160; I was allowed to spend some weeks studying books and even going for a week of training (SSAS).</p>
<p>I was also encouraged to start blogging.&#160; Initially it was a challenge to find topics to blog about.&#160; But only initially, nowadays I&#8217;ve got too many topics and not enough time.&#160; I discovered it was actually interesting to write about things I&#8217;d encountered for real.</p>
<p>Here’s such an example.&#160; In one of my shorter project interventions, I ended up calling a web service through SQL CLR.&#160; This was not an easy task.&#160; Without my developer background I would probably never have succeeded here!&#160; When I turned this into an article on my blog it became my first real hit!&#160; The article, <a title="Calling a Web Service From SQL Server 2005" href="http://blog.hoegaerden.be/2008/11/11/calling-a-web-service-from-sql-server-2005/" target="_blank">Calling a Web Service From SQL Server 2005</a>, was posted Nov 11, 2008 and has gotten over 26,000 page views to date.&#160; Even today it is still one of the more popular pages I&#8217;m hosting.</p>
<p>Besides teaching others through my blog I also discovered that forums can be a really interesting way to improve skills.&#160; So in August 2008 I created a free account at <a title="My profile at Experts Exchange" href="http://www.experts-exchange.com/M_4543448.html" target="_blank">Experts Exchange</a>.&#160; I also found out that helping out on forums combined with blogging is a real win-win situation: it helps me to find topics to write about and I can help people out by referring to an already-written article!</p>
<p>In February 2012 I was delighted to read that EE had found my forum activity worth an extra credit so I was given the <a title="Most Valuable Experts 2012" href="http://blog.experts-exchange.com/ee-blog/meet-the-2012-most-valuable-experts/" target="_blank">MVE</a> &#8211; Most Valuable Expert &#8211; award! Since then I have managed to reach the number one position in <a title="SQL Server Reporting Services @ EE" href="http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/" target="_blank">the SSRS zone</a> with over one million points in total and it looks like I&#8217;ll be staying there for some time.</p>
<p>Lately I have started presenting.&#160; So far I have found that to be a stressing yet rewarding experience.&#160; My next presentation will be at the <a title="Community Day" href="http://www.communityday.be/" target="_blank">Community Day</a> where both I and my colleague <a title="Koen Verbeeck" href="http://blogs.lessthandot.com/index.php/All/?disp=authdir&amp;author=940" target="_blank">Koen Verbeeck</a> will each talk for about half an hour about SSRS visualizations.&#160; The target audience are mainly developers, that&#8217;s going to be interesting!&#160; And it will be my first time on a stage in a cinema room, fearing the spotlights already!</p>
<p>Ow, and <a title="Register for Community Day 2013" href="http://www.communityday.be/cd/tabid/58/Default.aspx" target="_blank">registration is open</a> so see you there?&#160; Come over to say hello if you are planning to attend the conference.&#160; We are scheduled in the first slot so once that’s over I’ll be relieved of my stress!</p>
<h2>Conclusion</h2>
<p>Did a change in technology influence my career path?&#160; Ow yeah, I do believe it did!&#160; SQL Server was not the only tech that influenced it but I do consider it the most significant one.&#160; And I&#8217;m glad it did too, keeps things challenging!&#160; </p>
<p>Now I’m off to install Oracle.&#160; So long, and thanks for all the fish!</p>
<p>PS: one of my statements in this post is a lie.</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F05%2F14%2Ft-sql-tuesday-42-life-change-dont-panic%2F&amp;title=T-SQL%20Tuesday%2042%3A%20Life%2C%20Change%2C%20Don%E2%80%99t%20Panic%21" id="wpa2a_6"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=xwVJPPLyGnk:oqyQTi1T8TI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=xwVJPPLyGnk:oqyQTi1T8TI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=xwVJPPLyGnk:oqyQTi1T8TI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=xwVJPPLyGnk:oqyQTi1T8TI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=xwVJPPLyGnk:oqyQTi1T8TI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=xwVJPPLyGnk:oqyQTi1T8TI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=xwVJPPLyGnk:oqyQTi1T8TI:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=xwVJPPLyGnk:oqyQTi1T8TI:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=xwVJPPLyGnk:oqyQTi1T8TI:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/xwVJPPLyGnk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/05/14/t-sql-tuesday-42-life-change-dont-panic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/05/14/t-sql-tuesday-42-life-change-dont-panic/</feedburner:origLink></item>
		<item>
		<title>Local Install of Books Online 2012</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/n4A6j2NOdRc/</link>
		<comments>http://blog.hoegaerden.be/2013/05/10/local-install-of-books-online-2012/#comments</comments>
		<pubDate>Fri, 10 May 2013 10:05:00 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[BOL]]></category>
		<category><![CDATA[Books Online]]></category>
		<category><![CDATA[SQL Server 2012]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/05/10/local-install-of-books-online-2012/</guid>
		<description><![CDATA[The other day I needed to be able to study the SQL Server 2012 documentation, aka Books Online or BOL, to prepare for an exam while sitting on the train. So I was looking for the latest BOL download but that search wasn&#8217;t very successful. It took me a while to realize that what I [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I needed to be able to study the SQL Server 2012 documentation, aka Books Online or BOL, to prepare for an exam while sitting on the train. So I was looking for the latest BOL download but that search wasn&#8217;t very successful. It took me a while to realize that what I was doing was no longer valid! Microsoft is no longer distributing the Books Online through the Downloads site!</p>
<p>Well, not entirely true, read on for details.</p>
<p>Because it took me some time to realize what was going on I decided to write a quick post on how to make the BOL 2012 available locally. Basically you&#8217;ve got two options.&#160; Let&#8217;s start with the first one.</p>
<h2>Method 1: Help Library Manager</h2>
<p>The first &#8211; newly-introduced in SQL Server 2012 &#8211; method uses something called <a title="Help Library Manager" href="http://msdn.microsoft.com/en-us/library/dd264831(v=vs.100).aspx" target="_blank">Help Library Manager</a>.</p>
<p>This is a generic Microsoft product documentation management system, not exclusively for SQL Server.</p>
<p>Here are the steps to follow to get the SQL Server 2012 docs installed locally.&#160; This method assumes that you’ve already got SQL Server 2012 installed and that your PC is connected to the internet.</p>
<p>To start, click the <strong>Manage Help Settings</strong> link located in the Documentation &amp; Community subgroup of your SQL Server 2012 start menu shortcut group.</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Manage Help Settings" border="0" alt="Manage Help Settings" src="http://blog.hoegaerden.be/wp-content/uploads/image593.png" width="262" height="325" /></p>
<p>This will open up the Help Library Manager mentioned earlier:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Help Library Manager: installing online content" border="0" alt="Help Library Manager: installing online content" src="http://blog.hoegaerden.be/wp-content/uploads/image594.png" width="571" height="388" /></p>
<p>Click the <strong>Install content from online</strong> link.&#160; The Help Library Manager starts by fetching the list of available books.&#160; Once finished, locate the SQL Server 2012 content:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Installing the SQL Server 2012 books" border="0" alt="Installing the SQL Server 2012 books" src="http://blog.hoegaerden.be/wp-content/uploads/image595.png" width="571" height="388" /></p>
<p>Click the <strong>Add</strong> link next to any book you’d like to install locally.&#160; The link will change to Cancel as shown in following screenshot:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Selecting the books to be installed locally" border="0" alt="Selecting the books to be installed locally" src="http://blog.hoegaerden.be/wp-content/uploads/image596.png" width="571" height="388" /></p>
<p>When you’ve selected all books you’re interested in, click the Update button.&#160; The Library Manager will now start downloading all the content you’ve requested.</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Help Library Manager is downloading the requested packages" border="0" alt="Help Library Manager is downloading the requested packages" src="http://blog.hoegaerden.be/wp-content/uploads/image597.png" width="571" height="388" /></p>
<p>Now go and get a coffee.&#160; When you’re back, you should be able to click the <strong>Finish</strong> button and the Books Online will be available locally:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="SQL Server 2012 Books Online ready to be used" border="0" alt="SQL Server 2012 Books Online ready to be used" src="http://blog.hoegaerden.be/wp-content/uploads/image598.png" width="367" height="155" /></p>
<h2>Method 2: Download from Download Center</h2>
<p>It turns out Microsoft took into account that not all computers are able to access the internet, which is a requirement for method 1.&#160; Microsoft does still have something available for download through the Download Center.&#160; However, when I came across the link I hadn’t realized that this was actually the BOL download.&#160; The reason that I didn&#8217;t realize this was because the stand-alone BOL download is now called <strong>Product Documentation for Microsoft SQL Server 2012 for firewall and proxy restricted environments</strong>. I thought this was documentation regarding firewall and other network-related issues but this is actually the full Books Online download!</p>
<p>So if you’re interested in the old-skool BOL download, check this out: <a title="Product Documentation for Microsoft SQL Server 2012 for firewall and proxy restricted environments" href="http://www.microsoft.com/en-us/download/details.aspx?id=347" target="_blank">[Download Center] Product Documentation for Microsoft SQL Server 2012 for firewall and proxy restricted environments</a></p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><strong>References     <br /></strong><a title="Add or Remove Product Documentation for SQL Server" href="http://msdn.microsoft.com/library/ms166022(v=SQL.110).aspx" target="_blank">Add or Remove Product Documentation for SQL Server</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F05%2F10%2Flocal-install-of-books-online-2012%2F&amp;title=Local%20Install%20of%20Books%20Online%202012" id="wpa2a_8"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=n4A6j2NOdRc:7K1lXG5Ws7Y:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=n4A6j2NOdRc:7K1lXG5Ws7Y:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=n4A6j2NOdRc:7K1lXG5Ws7Y:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=n4A6j2NOdRc:7K1lXG5Ws7Y:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=n4A6j2NOdRc:7K1lXG5Ws7Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=n4A6j2NOdRc:7K1lXG5Ws7Y:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=n4A6j2NOdRc:7K1lXG5Ws7Y:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=n4A6j2NOdRc:7K1lXG5Ws7Y:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=n4A6j2NOdRc:7K1lXG5Ws7Y:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/n4A6j2NOdRc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/05/10/local-install-of-books-online-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/05/10/local-install-of-books-online-2012/</feedburner:origLink></item>
		<item>
		<title>Hidden Collections in SSRS</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/BnsXFbmku2U/</link>
		<comments>http://blog.hoegaerden.be/2013/03/19/hidden-collections-in-ssrs/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 17:30:38 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[articles]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/03/19/hidden-collections-in-ssrs/</guid>
		<description><![CDATA[If you’re reading this, you’re probably already aware that SQL Server Reporting Services has got some useful collections that can be used in expressions all over the report?  Well, just in case you’re not, I’ll cover not just the hidden ones but all of them. Collections, huh? If you’ve got some programming experience then I’m [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0px 0px 0px 5px; display: inline; float: right;" title="Fruit Basket (ref. http://ciaopaolo.com/store/category/fruit-gift-baskets/)" src="http://ciaopaolo.com/wp-content/uploads/2012/11/gift_baskets_fruit_large.jpg" alt="Fruit Basket (ref. http://ciaopaolo.com/store/category/fruit-gift-baskets/)" width="398" height="235" align="right" />If you’re reading this, you’re probably already aware that SQL Server Reporting Services has got some useful collections that can be used in expressions all over the report?  Well, just in case you’re not, I’ll cover not just the hidden ones but all of them.</p>
<h2>Collections, huh?</h2>
<p>If you’ve got some programming experience then I’m sure this concept is familiar to you.  On the other hand, and in that case you’re new to all this, think of a collection as a, well… a gathering of objects.  Similar to a fruit basket which is a collection of fruit.</p>
<p>Let’s first have a look at the syntax, how can these collections be used?</p>
<p><em>I’m using SSRS 2012 SP1 but this concept is not new.  I believe all expression will even work in SSRS 2005.</em></p>
<h3>Collection Syntax</h3>
<p>Each item in a collection can be referenced through two different methods, both giving the same result.  Let’s continue the fruit basket example.  If SSRS had a collection called <em>FruitCollection</em>, you’d be able to reference the different fruits in that basket through following syntax:</p>
<pre class="code">FruitCollection!FruitName</pre>
<p>For instance <em>FruitCollection!Lemon </em>will give you the Lemon object, assuming such an object exists in the collection.  That’s the first method.  The advantage of this method is that the expression builder will display a nice popup list of all the items in the collection once you’ve typed the exclamation mark.</p>
<p>The second method of referencing an item in the collection is by using the following Visual Basic syntax:</p>
<pre class="code">FruitCollection(<span style="color: #a31515;">"Lemon"</span>)</pre>
<p>This syntax requires you to pass the object name as a string.  As a result of that, you don’t get any syntax checks on the object name, so if you’d typed Limon you would only notice the problem when you actually run the report and get an error.  That’s why I prefer using the syntax with the exclamation mark so that’s the syntax I will be using for the examples further down in this article.</p>
<p>Each object in a collection also has a number of properties that can be consulted.  To continue the fruit basket example, the <em>Lemon</em> object could have a <em>Color</em> property.  To access that property you would use this expression:</p>
<pre class="code">FruitCollection!Lemon.Color</pre>
<p>Alright, time to have a closer look at the different collections in SSRS!</p>
<h3>The Parameters Collection</h3>
<p>If you’ve got any experience implementing report parameters, I’m sure you already know this one.  The <strong>Parameters</strong> collection allows you to access your report parameters.</p>
<p>In case you’re dealing with a multiple-valued parameter, there are a couple of interesting properties you should be aware of, such as the <em>Count</em> and <em>IsMultiValue</em> property.  Careful though: the <em>Count</em> property returns the <span style="text-decoration: underline;">number of selected values</span>, not the number of available values!</p>
<p>To reference just one of the selected values you can use the following syntax:</p>
<pre class="code">Parameters!YourParameter.Value(0)</pre>
<p>This expression will return the Value property of the first item in the selected items list.  Note that it’s a zero-based index.</p>
<p>Another interesting function you should be aware of is the <a title="Shall We Join Or Shall We Split Now?" href="http://blog.hoegaerden.be/2012/12/11/shall-we-join-or-shall-we-split-now/" target="_blank">Join</a>.  It allows you to join the different selected values together into one string.</p>
<p>The screenshot below shows you some expressions and their result.  The Category parameter has got three available values with two of them selected.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="The Parameters Collection" src="http://blog.hoegaerden.be/wp-content/uploads/image587.png" border="0" alt="The Parameters Collection" width="451" height="237" /></p>
<h3>The Variables Collection</h3>
<p>The <strong>Variables</strong> collection gives you access to the report variables.  To demonstrate this, I’ve set up the following variable:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="Report Variables" src="http://blog.hoegaerden.be/wp-content/uploads/image588.png" border="0" alt="Report Variables" width="585" height="482" /></p>
<p>And here’s the expression to access its value:</p>
<pre class="code">Variables!MyVariable.Value</pre>
<h3>The Globals and User Collections</h3>
<p>The <strong>Globals</strong> and <strong>User</strong> collections contain some useful properties and are provided by default in every report.  These are the items available through the <em>Built-in Fields</em> category in the expression builder:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="The Built-in Fields: objects in Globals and User collection" src="http://blog.hoegaerden.be/wp-content/uploads/image589.png" border="0" alt="The Built-in Fields: objects in Globals and User collection" width="595" height="204" /></p>
<p>Through those collections you’ve got access to some really interesting properties, such as the <strong>RenderFormat.Name</strong> property which indicates what output format is being rendered.  I’ve actually mentioned this one before: <a title="Hide/Show Items Dependant On Export Format (SSRS)" href="http://blog.hoegaerden.be/2011/01/18/ssrs-hideshow-items-dependant-on-export-format/" target="_blank">Hide/Show Items Dependant On Export Format (SSRS)</a></p>
<p>Okay, time to get started with those hidden collections.  But first, why do I call them <em>hidden</em>?  Simple, because they are not shown in the expression builder Category list, as you can see from the previous screenshot.</p>
<h3>The (Hidden) ReportItems Collection</h3>
<p>A very commonly used collection is the one called <strong>ReportItems</strong>.  It allows you to reference the different textboxes on your report.  If you know that each “cell” in a Tablix is actually a Textbox, well, I’m sure you realize that this can be quite useful in certain situations.</p>
<p>Let’s have a look at a basic example.  Say I want to retrieve the list of selected Category values that’s shown in the screenshot in the Parameters Collection subchapter above.</p>
<p><strong>Tip:</strong> always give your textbox a clear name when you’re going to reference it in an expression.  Never use the default <em>Textbox666</em> name.  You can rename a textbox by changing its Name property.</p>
<p>In the following expression you can see that I’ve given the textbox another name, one that indicates what it contains:</p>
<pre class="code">ReportItems!txtFilterValues.Value</pre>
<p>And here’s the result of that expression:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Using the ReportItems collection" src="http://blog.hoegaerden.be/wp-content/uploads/image590.png" border="0" alt="Using the ReportItems collection" width="700" height="132" /></p>
<p><strong>Tip:</strong> the above is only possible if the textboxes are not in a group in the tablix.  So the tablix on the left does not contain any grouping, it’s a simple table with five basic rows and two columns.</p>
<h3>The (Hidden) DataSources and DataSets Collections</h3>
<p>Finally we’ve come to the collections which made me write this article.  Did you know it’s possible to display your dataset query in your report?  That’s right, through the <strong>DataSets</strong> collection you can access your actual query string!  And through the <strong>DataSources</strong> collection you have access to some other properties, such as the source type and the shared data source being referenced.</p>
<p>My report has got the following data sources and datasets defined:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="Data Sources and Datasets" src="http://blog.hoegaerden.be/wp-content/uploads/image591.png" border="0" alt="Data Sources and Datasets" width="197" height="130" /></p>
<p>As indicated by the arrow in the data source icon, <em>AdventureWorksDW2012</em> is referencing a shared data source while <em>tempdb_embedded</em> is an embedded source in the report.</p>
<p>Here are some examples of possible expressions and their result:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="Using the DataSources and DataSets collections" src="http://blog.hoegaerden.be/wp-content/uploads/image592.png" border="0" alt="Using the DataSources and DataSets collections" width="700" height="229" /></p>
<p>Through the <strong>DataSources</strong> collection you have access to a <em>Type</em> property on the source.  This property is only given a value in case of an embedded data source.</p>
<p>You also have access to a property called <em>DataSourceReference</em>.  It contains the name of the shared data source being referenced so only contains a value in case of a shared data source.</p>
<p>And through the DataSets collection you can access the CommandText property, which returns your actual query statement.  This can be particularly useful when you’re building your query dynamically through an expression, very interesting for troubleshooting!</p>
<p>There’s also a property called RewrittenCommandText.  When I initially saw that property I thought it would return the statement with any parameters replaced with their actual values.  Well, I was wrong, as the screenshot above indicates.  Apparently this property is used for model-based queries, as <a title="What DataSet Query Text Is Executed?" href="http://blogs.msdn.com/b/robertbruckner/archive/2008/10/25/what-dataset-query-text-is-executed.aspx" target="_blank">mentioned by Robert Bruckner</a>.  I try to avoid report models…</p>
<h2>Conclusion</h2>
<p>This article introduced the concept of collections in Reporting Services and then went into explaining the use of each of them, including a couple of hidden collections.</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><strong>References</strong></p>
<p><a title="Built-in Collections in Expressions (Report Builder and SSRS)" href="http://msdn.microsoft.com/en-us/library/dd255235.aspx" target="_blank">Built-in Collections in Expressions (Report Builder and SSRS)</a></p>
<p><a title="What DataSet Query Text Is Executed?" href="http://blogs.msdn.com/b/robertbruckner/archive/2008/10/25/what-dataset-query-text-is-executed.aspx" target="_blank">What DataSet Query Text Is Executed?</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F03%2F19%2Fhidden-collections-in-ssrs%2F&amp;title=Hidden%20Collections%20in%20SSRS" id="wpa2a_10"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=BnsXFbmku2U:bv5qvlK79H8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=BnsXFbmku2U:bv5qvlK79H8:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=BnsXFbmku2U:bv5qvlK79H8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=BnsXFbmku2U:bv5qvlK79H8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=BnsXFbmku2U:bv5qvlK79H8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=BnsXFbmku2U:bv5qvlK79H8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=BnsXFbmku2U:bv5qvlK79H8:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=BnsXFbmku2U:bv5qvlK79H8:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=BnsXFbmku2U:bv5qvlK79H8:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/BnsXFbmku2U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/03/19/hidden-collections-in-ssrs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/03/19/hidden-collections-in-ssrs/</feedburner:origLink></item>
		<item>
		<title>How To Tweet About SQL Server Blog Posts</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/asL9TuYMgag/</link>
		<comments>http://blog.hoegaerden.be/2013/03/08/how-to-tweet-about-sql-server-blog-posts/#comments</comments>
		<pubDate>Fri, 08 Mar 2013 16:54:59 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/03/08/how-to-tweet-about-sql-server-blog-posts/</guid>
		<description><![CDATA[Ever since I started using @ValentinoV on Twitter a bit more actively, which is now more than a year ago, I have also been exploring different methods of announcing my new blog posts to the world.&#160; One of the methods I use is sending out a couple of tweets to my followers.&#160; So far I [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since I started using <a title="@ValentinoV on Twitter" href="http://twitter.com/ValentinoV42" target="_blank">@ValentinoV on Twitter</a> a bit more actively, which is now more than a year ago, I have also been exploring different methods of announcing my new blog posts to the world.&#160; One of the methods I use is sending out a couple of tweets to my followers.&#160; So far I had been adding the prefix <strong>[Blog]</strong> as a standardized way of working and I also add relevant hashtags, such as #SSRS when the post is about Reporting Services.</p>
<p>Here’s an example:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="Tweet using the [Blog] prefix" border="0" alt="Tweet using the [Blog] prefix" src="http://blog.hoegaerden.be/wp-content/uploads/image583.png" width="513" height="70" /></p>
<p>Then Jamie Thomson, aka <a title="SSIS Junkie" href="http://sqlblog.com/blogs/jamie_thomson/default.aspx" target="_blank">SSIS Junkie</a>, made me aware of a blog post he had posted earlier this week.</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="The power of Twitter: being able to quickly contact someone without the need of email" border="0" alt="The power of Twitter: being able to quickly contact someone without the need of email" src="http://blog.hoegaerden.be/wp-content/uploads/image584.png" width="511" height="192" /></p>
<p>And in that post, he introduced an interesting alternative to what I (and a lot of other SQL Server bloggers) was doing!&#160; Instead of using that [Blog] prefix it’s better to use a hashtag!&#160; Why is that better?&#160; Well, because searches and filters on hashtags work better than searches on just plain text. In fact, he proposes several hashtags.&#160; Have a look at his post for the details: <a title="Bootstrapping SQL Server bloggers and blog readers with Twitter!" href="http://sqlblog.com/blogs/jamie_thomson/archive/2013/03/04/bootstrapping-sql-server-bloggers-and-blog-readers-with-twitter.aspx" target="_blank">Bootstrapping SQL Server bloggers and blog readers with Twitter!</a></p>
<p>And here’s my earlier tweet reworked as per Jamie’s proposed standards:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="Tweet using Jamie Thomson standards" border="0" alt="Tweet using Jamie Thomson standards" src="http://blog.hoegaerden.be/wp-content/uploads/image585.png" width="515" height="80" /></p>
<p>However, the #blogged hashtag is not the one I will be using.&#160; Several other bloggers commented on his post that they’re more in favor of the concatenation of #blogged and #sqlserver into<strong> #sqlblog</strong>.&#160; I like that proposal because it’s closer to my earlier prefix and it uses less characters.&#160; Given the nature of Twitter, if we can deliver the same message using less characters then that would be the preferred method, right? So that’s the one I will be using from now on!</p>
<p>I’ll even demonstrate it by updating this post once I’ve tweeted about it.&#160; Yeah, a recursive blog post!</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="Tweet to demonstrate usage of the adapted standard" border="0" alt="Tweet to demonstrate usage of the adapted standard" src="http://blog.hoegaerden.be/wp-content/uploads/image586.png" width="431" height="159" /></p>
<p>Have fun, and spread the word!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F03%2F08%2Fhow-to-tweet-about-sql-server-blog-posts%2F&amp;title=How%20To%20Tweet%20About%20SQL%20Server%20Blog%20Posts" id="wpa2a_12"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=asL9TuYMgag:DDL504tpT_4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=asL9TuYMgag:DDL504tpT_4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=asL9TuYMgag:DDL504tpT_4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=asL9TuYMgag:DDL504tpT_4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=asL9TuYMgag:DDL504tpT_4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=asL9TuYMgag:DDL504tpT_4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=asL9TuYMgag:DDL504tpT_4:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=asL9TuYMgag:DDL504tpT_4:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=asL9TuYMgag:DDL504tpT_4:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/asL9TuYMgag" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/03/08/how-to-tweet-about-sql-server-blog-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/03/08/how-to-tweet-about-sql-server-blog-posts/</feedburner:origLink></item>
		<item>
		<title>Filtering Data Without Changing Dataset [SSRS]</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/fW1qQI2zYX0/</link>
		<comments>http://blog.hoegaerden.be/2013/03/02/filtering-data-without-changing-dataset-ssrs/#comments</comments>
		<pubDate>Sat, 02 Mar 2013 14:43:20 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[articles]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/03/02/filtering-data-without-changing-dataset-ssrs/</guid>
		<description><![CDATA[In this article I&#8217;ll be describing a method which you can use to filter data in your Reporting Services reports without making any changes to the dataset query. To get started, I&#8217;ll first imagine I’m being interviewed.  (Yeah, I like that.) Q: You mentioned &#8220;without making any changes to the dataset query&#8221;.  So you&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<p><img style="background-image: none; margin: 0px 0px 10px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border: 0px;" title="Unfiltered Coffee - http://www.flickr.com/photos/derektor/92480692/" src="http://farm1.staticflickr.com/17/92480692_9ba08b9018_z.jpg" border="0" alt="Unfiltered Coffee - http://www.flickr.com/photos/derektor/92480692/" width="258" height="344" align="right" />In this article I&#8217;ll be describing a method which you can use to filter data in your Reporting Services reports without making any changes to the dataset query.</p>
<p>To get started, I&#8217;ll first imagine I’m being interviewed.  (Yeah, I like that.)</p>
<p><em><strong>Q:</strong> You mentioned &#8220;without making any changes to the dataset query&#8221;.  So you&#8217;ll be filtering on the SSRS side then?</em></p>
<p><strong>A:</strong> (Darn, I think she&#8217;s onto me.)  Well, yes.</p>
<p><em><strong>Q:</strong> Would you recommend this method?</em></p>
<p><strong>A:</strong> (Yep, she is.) Well, erm, no.  For performance reasons it&#8217;s much better to filter on the database server side.  You don&#8217;t waste any network bandwidth and database servers are specialized in filtering data.</p>
<p><em><strong>Q:</strong> Then why are you writing an article about filtering on the report side?</em></p>
<p><strong>A:</strong> Well, because sometimes you don&#8217;t have another option.  Not all data sources are as flexible as SQL Server, and SSRS supports many different providers.  In some occasions, the DBA that supports exotic data source X gives you a command, similar to a stored procedure call, that returns the data for your report.  And you don&#8217;t get any say on how that gets implemented, you&#8217;re just told to use that command.  Unfortunately that command returns items A-Z while the report has an item filter.  In those scenarios, it&#8217;s interesting if you&#8217;d be able to filter on the report side.</p>
<p><em><strong>Q:</strong> Let&#8217;s say I would like to filter on the database server side, how would I do that?</em></p>
<p><strong>A:</strong> Just use the <a title="WHERE (Transact-SQL)" href="http://msdn.microsoft.com/en-us/library/ms188047.aspx" target="_blank">WHERE clause</a> in your query.</p>
<p>Alright, enough intro, time to start the article!</p>
<p>To build the report I’ll be using SQL Server 2012, more precisely:</p>
<blockquote><p><em>Microsoft SQL Server 2012 (SP1) &#8211; 11.0.3000.0 (X64)<br />
Oct 19 2012 13:38:57<br />
Copyright (c) Microsoft Corporation<br />
Developer Edition (64-bit) on Windows NT 6.1 &lt;X64&gt; (Build 7601: Service Pack 1)</em></p></blockquote>
<p>I’ve made the RDL available for <a title="FilterWithoutDatasetChanges.rdl" href="https://skydrive.live.com/embed?cid=81C8B064CBBE1698&amp;resid=81C8B064CBBE1698%21162&amp;authkey=ADCHquTTv_LKG3A" target="_blank">download from my SkyDrive</a>.</p>
<h2>The Scenario</h2>
<p>You&#8217;ve been asked to develop a report that shows a list of products, grouped by category.  The report needs to take a filter on product category into account.  The values on which you need to filter are stored in a configuration table.  You&#8217;ve been given a query which for some mystical reason can&#8217;t be modified.</p>
<p>Weird enough?  Okay, let&#8217;s get that implemented then!</p>
<h2>The Report</h2>
<p>Let&#8217;s first set up a simple report with a dataset and a table.  The table groups the products on category:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="A Grouped Table" src="http://blog.hoegaerden.be/wp-content/uploads/image572.png" border="0" alt="A Grouped Table" width="451" height="117" /></p>
<p>In Preview it would look like this:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="List of products grouped on category" src="http://blog.hoegaerden.be/wp-content/uploads/image573.png" border="0" alt="List of products grouped on category" width="431" height="241" /></p>
<p>The dataset used in the report above is called <strong>ProductList</strong> and uses the following query:</p>
<pre class="code"><span style="color: blue;">select </span><span style="color: teal;">DPC</span><span style="color: gray;">.</span><span style="color: teal;">EnglishProductCategoryName ProductCategoryName
    </span><span style="color: gray;">, </span><span style="color: teal;">DPS</span><span style="color: gray;">.</span><span style="color: teal;">EnglishProductSubcategoryName ProductSubcategoryName
    </span><span style="color: gray;">, </span><span style="color: teal;">DP</span><span style="color: gray;">.</span><span style="color: teal;">EnglishProductName ProductName
</span><span style="color: blue;">from </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DimProduct DP
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DimProductSubcategory DPS
    </span><span style="color: blue;">on </span><span style="color: teal;">DPS</span><span style="color: gray;">.</span><span style="color: teal;">ProductSubcategoryKey </span><span style="color: gray;">= </span><span style="color: teal;">DP</span><span style="color: gray;">.</span><span style="color: teal;">ProductSubcategoryKey
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DimProductCategory DPC
    </span><span style="color: blue;">on </span><span style="color: teal;">DPC</span><span style="color: gray;">.</span><span style="color: teal;">ProductCategoryKey </span><span style="color: gray;">= </span><span style="color: teal;">DPS</span><span style="color: gray;">.</span><span style="color: teal;">ProductCategoryKey
</span><span style="color: blue;">order by </span><span style="color: teal;">DPC</span><span style="color: gray;">.</span><span style="color: teal;">EnglishProductCategoryName</span><span style="color: gray;">, </span><span style="color: teal;">DPS</span><span style="color: gray;">.</span><span style="color: teal;">EnglishProductSubcategoryName
    </span><span style="color: gray;">, </span><span style="color: teal;">DP</span><span style="color: gray;">.</span><span style="color: teal;">EnglishProductName</span><span style="color: gray;">;</span></pre>
<h3>Retrieving The Filter Configuration</h3>
<p>So now we need to filter this report based on configuration stored in a table.  That means we&#8217;ll need an additional dataset, let’s use the following query and call it <strong>CategoryFilter</strong>:</p>
<pre class="code"><span style="color: blue;">select </span><span style="color: red;">'Category' </span><span style="color: teal;">FilterName</span><span style="color: gray;">, </span><span style="color: red;">'Components' </span><span style="color: teal;">FilterValue
</span><span style="color: blue;">union </span><span style="color: gray;">all </span><span style="color: blue;">select </span><span style="color: red;">'Category'</span><span style="color: gray;">, </span><span style="color: red;">'Clothing'</span></pre>
<p>(Sure, I&#8217;ve hardcoded the configuration data but for scenario&#8217;s sake, imagine it&#8217;s coming from a table.)</p>
<p>Here’s what the result looks like:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="The Category Filter" src="http://blog.hoegaerden.be/wp-content/uploads/image574.png" border="0" alt="The Category Filter" width="183" height="62" /></p>
<p>The dataset contains two fields: the name of the filter and a value on which to filter.  Each value on which we need to filter has its own record.  Having this <em>FilterName</em> field in the table means that it can be re-used for several different filters, if needed.  Your dataset would then use a WHERE FilterName = ‘YourFilter’ clause.</p>
<p>Now, one crucial question remains: <strong><em>how can we use this dataset to filter the data from the other dataset?</em></strong></p>
<p>Depending on your requirements, there are several possibilities. If you&#8217;re sure none of your data regions require the data that will get filtered out, you can use the <strong>Filter options on the Dataset</strong>.  Alternatively you can use the <strong>Filter options on your data region</strong>.  In any case, those filters all use the same interface, so implementation-wise it&#8217;s all the same.</p>
<p>I&#8217;ll implement the filter on the tablix, this gives me the opportunity to show how to get to the properties (dataset is easier).</p>
<p>Okay, so how do we implement a filter on a tablix?</p>
<p>First select the Tablix and right-click the grey square in the top left corner:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Opening the Tablix Properties" src="http://blog.hoegaerden.be/wp-content/uploads/image575.png" border="0" alt="Opening the Tablix Properties" width="254" height="201" /></p>
<p>Select <strong>Tablix Properties</strong> and switch to the <strong>Filters</strong> page.  Click the <strong>Add</strong> button to add a filter.  As you can see, filters support expressions.  That&#8217;s a good thing!</p>
<p>In the <strong>Expression</strong> combobox, select the field on which you want to filter the data.</p>
<p>The <strong>Operator</strong> that fits with our requirements should be one that supports multiple values.  In case you’re wondering why, take a good look at our <em>CategoryFilter</em> dataset mentioned earlier.  We want to filter on both Components and Clothing.  So the default equals sign is not really what we&#8217;re after, the <strong>IN operator </strong>will serve much better.</p>
<p>The only remaining empty textbox is <strong>Value</strong>.  How can we get the values from our filter dataset into this textbox?  In any case, we&#8217;ll need to use an expression so click the little <em>fx</em> button next to the Value textbox.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Adding a Filter to the Tablix" src="http://blog.hoegaerden.be/wp-content/uploads/image576.png" border="0" alt="Adding a Filter to the Tablix" width="592" height="268" /></p>
<p>As you&#8217;re probably aware, a data region can only be linked to one dataset.  Which means we can&#8217;t say:</p>
<pre class="code">=Fields!FilterValue.Value</pre>
<p>because FilterValue doesn&#8217;t exist in the dataset that&#8217;s linked to the tablix.</p>
<p>So how can we implement a filter based on data from another dataset?  Once again we&#8217;ve got several options.  Let&#8217;s look into them!</p>
<h3>Option One: Report Parameter</h3>
<p>If we&#8217;d set up a<strong> Report Parameter</strong>, we could reference that, right?  Let&#8217;s close the properties popup for now (click OK) and create a new report parameter:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image577.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Adding a report parameter" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb112.png" border="0" alt="Adding a report parameter" width="700" height="382" /></a></p>
<p>Our parameter is called <em>CategoryFilter, </em>its type is <strong>Text</strong> and it should <strong>allow multiple values</strong>.  We&#8217;ll also set visibility to <strong>Internal</strong> because it doesn&#8217;t need to get exposed in any way.</p>
<p>The parameter’s default values are the values retrieved by the CategoryFilter dataset, so switch to the <strong>Default Values </strong>page and specify the dataset as shown in the screenshot:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Retrieving the default values from a query" src="http://blog.hoegaerden.be/wp-content/uploads/image578.png" border="0" alt="Retrieving the default values from a query" width="585" height="482" /></p>
<p>With the parameter created, switch back to the <strong>Filters</strong> page on the<strong> Tablix Properties</strong> and enter the following expression:</p>
<pre class="code">=Parameters!CategoryFilter.Value</pre>
<p>If you&#8217;ve created the expression by double-clicking the parameter in the Values box, don&#8217;t forget to remove the (0) or your data will get filtered on the first item only.</p>
<p>Click OK and render the report:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Report Preview now shows Clothing as first category" src="http://blog.hoegaerden.be/wp-content/uploads/image579.png" border="0" alt="Report Preview now shows Clothing as first category" width="398" height="253" /></p>
<p>It&#8217;s working!  Accessories is no longer the first category that gets shown because it’s been filtered out.  The data is now filtered on the configuration as specified through the second dataset.</p>
<p>But&#8230; do we really need to set up a report parameter for this?  Well, no!  Let&#8217;s investigate option number two.</p>
<h3>Option Two: The LookupSet Function</h3>
<p>A couple of years ago <a title="Looking Up Data On Different Sources" href="http://blog.hoegaerden.be/2010/05/16/looking-up-data-on-different-sources/" target="_blank">I wrote an article</a> to explain how you can retrieve data from another dataset through the new lookup functions.  Well, “new” at the time meant SQL Server 2008 R2.  We&#8217;re now on 2012 so the functions still exist!</p>
<p>The function that can help us out today is <strong>LookupSet</strong>.  Open up the Filter properties once again and replace the Value expression with the following:</p>
<pre class="code">=LookupSet(<span style="color: #a31515;">"Category"</span>, Fields!FilterName.Value, Fields!FilterValue.Value, <span style="color: #a31515;">"CategoryFilter"</span>)</pre>
<p>Close the popup window and preview the report.  If it runs fine, delete the report parameter and run the preview again.</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Filtering the data using the LookupSet function" src="http://blog.hoegaerden.be/wp-content/uploads/image580.png" border="0" alt="Filtering the data using the LookupSet function" width="700" height="243" /></p>
<p>Yes, it still works, nice!  So we don’t need to use a report parameter to filter our data, we can use a fairly simple expression using the LookupSet function!</p>
<h3>Option Three: The Split Function</h3>
<p>To finalize let&#8217;s investigate a variation on the requirement.  In this variation, the filter configuration doesn&#8217;t need to come from a table.  It can just be hardcoded in the report.  Can we do that, without using an additional dataset?  Yes we can!</p>
<p>In the Filter properties, change the Value expression to:</p>
<pre class="code">=<span style="color: #a31515;">"Components,Clothing"</span></pre>
<p>Now render the report:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Oh no, the data is gone!" src="http://blog.hoegaerden.be/wp-content/uploads/image581.png" border="0" alt="Oh no, the data is gone!" width="465" height="175" /></p>
<p>Hmm, that didn&#8217;t work well.  Ow right, the IN operator expects an array of string values and not a comma-separated value string.  Let&#8217;s see, how can we get an array out of a character-separated value string?  Actually, I&#8217;ve covered this in <a title="Shall We Join Or Shall We Split Now?" href="http://blog.hoegaerden.be/2012/12/11/shall-we-join-or-shall-we-split-now/" target="_blank">one of my #tsql2sday posts</a>.  We can use the <strong>Split</strong> function:</p>
<pre class="code">=Split(<span style="color: #a31515;">"Components,Clothing"</span>, <span style="color: #a31515;">","</span>)</pre>
<p>With that expression specified, let&#8217;s render the report a last time:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border: 0px;" title="Filtering the tablix using the Split function" src="http://blog.hoegaerden.be/wp-content/uploads/image582.png" border="0" alt="Filtering the tablix using the Split function" width="449" height="214" /></p>
<p>Woohoo, it works once again!</p>
<h2>Conclusion</h2>
<p>In this article I&#8217;ve demonstrated three different possibilities to implement filtering on multiple values on the report side.  It is not a recommended method but in some cases it can be very useful, especially when you don’t have another choice!</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F03%2F02%2Ffiltering-data-without-changing-dataset-ssrs%2F&amp;title=Filtering%20Data%20Without%20Changing%20Dataset%20%5BSSRS%5D" id="wpa2a_14"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=fW1qQI2zYX0:Jr6Qc7XJCvY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=fW1qQI2zYX0:Jr6Qc7XJCvY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=fW1qQI2zYX0:Jr6Qc7XJCvY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=fW1qQI2zYX0:Jr6Qc7XJCvY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=fW1qQI2zYX0:Jr6Qc7XJCvY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=fW1qQI2zYX0:Jr6Qc7XJCvY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=fW1qQI2zYX0:Jr6Qc7XJCvY:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=fW1qQI2zYX0:Jr6Qc7XJCvY:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=fW1qQI2zYX0:Jr6Qc7XJCvY:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/fW1qQI2zYX0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/03/02/filtering-data-without-changing-dataset-ssrs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/03/02/filtering-data-without-changing-dataset-ssrs/</feedburner:origLink></item>
		<item>
		<title>SSRS Deployment: Generate The Batch Script Through SQL!</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/7stl7LyvvOk/</link>
		<comments>http://blog.hoegaerden.be/2013/02/16/ssrs-deployment-generate-the-batch-script-through-sql/#comments</comments>
		<pubDate>Sat, 16 Feb 2013 13:33:57 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Reporting Services 2012]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/02/16/ssrs-deployment-generate-the-batch-script-through-sql/</guid>
		<description><![CDATA[This post is a follow-up to my presentation on Automating SSRS Deployments Using Built-in SQL Server Tools. During that presentation, I demonstrated that you can use the Reporting Services web service in a custom application to get a list of your deployed objects from the server.  Using that functionality you’d be able to generate the [...]]]></description>
			<content:encoded><![CDATA[<p><img style="background-image: none; margin: 0px 0px 5px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border: 0px;" title="Source: http://commons.wikimedia.org/wiki/File:Estrangela.jpg" src="http://blog.hoegaerden.be/wp-content/uploads/image564.png" border="0" alt="Source: http://commons.wikimedia.org/wiki/File:Estrangela.jpg" width="118" height="187" align="right" />This post is a follow-up to my presentation on <a title="Automating SSRS Deployments Using Built-in SQL Server Tools" href="http://blog.hoegaerden.be/2013/01/21/sqlug-automating-ssrs-deployments/" target="_blank">Automating SSRS Deployments Using Built-in SQL Server Tools</a>.</p>
<p>During that presentation, I demonstrated that you can use the Reporting Services web service in a custom application to get a list of your deployed objects from the server.  Using that functionality you’d be able to generate the batch script containing the RS commands which in their turn use the RSS scripts which I’ve demonstrated.</p>
<p><em>For those who missed the presentation but ended up here nevertheless, you can </em><a title="Automating SSRS Deployment: Download" href="http://blog.hoegaerden.be/2013/01/30/automating-ssrs-deployment-download/" target="_blank"><em>download the slides and demo code through my other follow-up post</em></a><em>.</em></p>
<p>However, that’s not the only option!</p>
<p>In this post I’ll be using a technique which is one of my favorite methods of saving work.  Instead of typing a lot of code yourself, type just a bit of code to generate the code that you actually want.  Or, in other words and more concrete: today I’ll be using T-SQL to generate the RS commands for the batch file!</p>
<p>I will be querying some SSRS system tables, so take into account that the code may need changes for future versions of SQL Server, but I can confirm that it should work with both SQL Server 2008 and 2012.  SQL Server 2005 probably too but I don’t have that running anymore so can’t test it out.  Don’t hesitate to leave a comment if you can confirm that this will run on 2005.</p>
<p>The database on which you need to run these queries is called <strong>ReportServer</strong>, or <strong>ReportServer$YourInstance</strong> if you didn’t install it with the default instance name.</p>
<h2>Figuring It All Out</h2>
<p>One of the tougher parts of writing these queries was figuring out how the system tables can be linked with each other.  I studied some of the stored procedures and combined that knowledge with what I actually saw as content on my test system.  I’ll first share a couple of generic queries which may prove useful in case you just want to query the tables.  Then I’ll share the queries that will produce the RS statements.</p>
<p>Usually you’re only interested in the objects that belong to your project.  So each of the following queries has a filter to only show the content of my project folder, called <strong>Awesome Reports</strong>.</p>
<h3>List Of Objects Dependent On Data Source</h3>
<p>The following query shows a list of all objects that have a data source dependency.</p>
<pre class="code"><span style="color: green;">--list of objects dependent on data sources
</span><span style="color: blue;">select
    case </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: teal;">[Type]
        </span><span style="color: blue;">when </span>1 <span style="color: blue;">then </span><span style="color: red;">'Folder'
        </span><span style="color: blue;">when </span>2 <span style="color: blue;">then </span><span style="color: red;">'Report'
        </span><span style="color: blue;">when </span>3 <span style="color: blue;">then </span><span style="color: red;">'Resource'
        </span><span style="color: blue;">when </span>4 <span style="color: blue;">then </span><span style="color: red;">'Linked Report'
        </span><span style="color: blue;">when </span>5 <span style="color: blue;">then </span><span style="color: red;">'Data Source'
        </span><span style="color: blue;">when </span>6 <span style="color: blue;">then </span><span style="color: red;">'Report Model'
        </span><span style="color: blue;">when </span>7 <span style="color: blue;">then </span><span style="color: red;">'???' </span><span style="color: green;">--post comment if you know what 7 means
        </span><span style="color: blue;">when </span>8 <span style="color: blue;">then </span><span style="color: red;">'Shared Dataset'
        </span><span style="color: blue;">when </span>9 <span style="color: blue;">then </span><span style="color: red;">'Report Part'
    </span><span style="color: blue;">end </span><span style="color: teal;">ObjectType
    </span><span style="color: gray;">, </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: teal;">Name
    </span><span style="color: gray;">, </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">Name DataSourceName
    </span><span style="color: gray;">, </span><span style="color: teal;">DSET_SRC</span><span style="color: gray;">.</span><span style="color: teal;">Name DatasetExternalDataSourceName
    </span><span style="color: gray;">, </span><span style="color: teal;">PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path
from </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">C
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">PARENT </span><span style="color: blue;">on </span><span style="color: teal;">PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSource DS </span><span style="color: blue;">on </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">ItemID
</span><span style="color: gray;">left outer join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSets DSET </span><span style="color: blue;">on </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">LinkID </span><span style="color: gray;">= </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: teal;">ItemID
</span><span style="color: gray;">left outer join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSource DSET_SRC </span><span style="color: blue;">on </span><span style="color: teal;">DSET_SRC</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">ItemID
</span><span style="color: blue;">where </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: blue;">Type </span><span style="color: gray;">&lt;&gt; </span>5 <span style="color: green;">--no data sources
    </span><span style="color: gray;">and </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">like </span><span style="color: red;">'/Awesome Reports/%'
</span><span style="color: blue;">order by </span><span style="color: teal;">c</span><span style="color: gray;">.</span><span style="color: blue;">Type</span><span style="color: gray;">, </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: teal;">Name
</span></pre>
<p>So what does this return on my test system?</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="List of objects with data source dependency" src="http://blog.hoegaerden.be/wp-content/uploads/image565.png" border="0" alt="List of objects with data source dependency" width="693" height="58" /></p>
<p>In the case of a shared dataset, the <em>DataSetDataSource</em> name is what the data source is called inside the shared dataset.  To get to the real name of the data source, we need to join with the dbo.DataSource table through the dbo.DataSets table while using the right key fields.</p>
<h3>List Of Datasets With Linked Data Source</h3>
<p>The query below can be interesting to generate a list of your datasets with their data source dependency, including their location.</p>
<pre class="code"><span style="color: green;">--list of datasets with linked data source
</span><span style="color: blue;">select </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">Name DatasetName
    </span><span style="color: gray;">, </span><span style="color: teal;">DSET_PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: teal;">DatasetLocation
    </span><span style="color: gray;">, </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">Name DataSourceName
    </span><span style="color: gray;">, </span><span style="color: teal;">DS_PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: teal;">DataSourceLocation
</span><span style="color: blue;">from </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSets DSET
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DSET_C </span><span style="color: blue;">on </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">LinkID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DSET_PARENT </span><span style="color: blue;">on </span><span style="color: teal;">DSET_PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSource DS </span><span style="color: blue;">on </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">ItemID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DS_C </span><span style="color: blue;">on </span><span style="color: teal;">DS_C</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">Link
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DS_PARENT </span><span style="color: blue;">on </span><span style="color: teal;">DS_PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DS_C</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: blue;">where </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">like </span><span style="color: red;">'/Awesome Reports/%'
</span></pre>
<p>On my system I get the following result:</p>
<p><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="List of datasets with their data source dependency" src="http://blog.hoegaerden.be/wp-content/uploads/image566.png" border="0" alt="List of datasets with their data source dependency" width="592" height="43" /></p>
<h2>Generating The RS Commands</h2>
<p>Using the knowledge we got by examining above queries, we can now build some queries that generate the RS commands.  And here they are:</p>
<pre class="code"><span style="color: green;">--generate DeployDataset commands
</span><span style="color: blue;">select </span><span style="color: red;">'%RS% -i "%SCRIPTLOCATION%\DeployDataset.rss" -s %REPORTSERVER% -l %TIMEOUT% -e %ENDPOINT% -v dataset="'
     </span><span style="color: gray;">+ </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: teal;">Name </span><span style="color: gray;">+ </span><span style="color: red;">'" -v datasetLocation="' </span><span style="color: gray;">+ </span><span style="color: teal;">DSET_PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path
     </span><span style="color: gray;">+ </span><span style="color: red;">'" -v dataSourceName="' </span><span style="color: gray;">+ </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">Name
     </span><span style="color: gray;">+ </span><span style="color: red;">'" -v dataSourceLocation="' </span><span style="color: gray;">+ </span><span style="color: teal;">DS_PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">+ </span><span style="color: red;">'"'
</span><span style="color: blue;">from </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSets DSET
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DSET_C </span><span style="color: blue;">on </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">LinkID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DSET_PARENT </span><span style="color: blue;">on </span><span style="color: teal;">DSET_PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSource DS </span><span style="color: blue;">on </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">ItemID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DS_C </span><span style="color: blue;">on </span><span style="color: teal;">DS_C</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">Link
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DS_PARENT </span><span style="color: blue;">on </span><span style="color: teal;">DS_PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DS_C</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: blue;">where </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">like </span><span style="color: red;">'/Awesome Reports/%'

</span><span style="color: green;">--generate DeployReport commands
</span><span style="color: blue;">select </span><span style="color: red;">'%RS% -i "%SCRIPTLOCATION%\DeployReport.rss" -s %REPORTSERVER% -l %TIMEOUT% -e %ENDPOINT% -v name="'
    </span><span style="color: gray;">+ </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: teal;">Name </span><span style="color: gray;">+ </span><span style="color: red;">'" -v folder="' </span><span style="color: gray;">+ </span><span style="color: teal;">PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">+ </span><span style="color: red;">'"'
</span><span style="color: blue;">FROM </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog AS </span><span style="color: teal;">C
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">PARENT </span><span style="color: blue;">on </span><span style="color: teal;">PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: blue;">where </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: blue;">Type </span><span style="color: gray;">= </span>2 <span style="color: green;">--report
    </span><span style="color: gray;">and </span><span style="color: teal;">C</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">like </span><span style="color: red;">'/Awesome Reports/%'

</span><span style="color: green;">--generate LinkReportToDataSource commands
</span><span style="color: blue;">select </span><span style="color: red;">'%RS% -i "%SCRIPTLOCATION%\LinkReportToDataSource.rss" -s %REPORTSERVER% -l %TIMEOUT% -e %ENDPOINT% -v reportName="'
    </span><span style="color: gray;">+ </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: teal;">Name </span><span style="color: gray;">+ </span><span style="color: red;">'" -v parent="' </span><span style="color: gray;">+ </span><span style="color: teal;">REP_PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">+ </span><span style="color: red;">'" -v dataSource="'
    </span><span style="color: gray;">+ </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">Name </span><span style="color: gray;">+ </span><span style="color: red;">'" -v dataSourceLocation="' </span><span style="color: gray;">+ </span><span style="color: teal;">DS_PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">+ </span><span style="color: red;">'"'
</span><span style="color: blue;">from </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog AS </span><span style="color: teal;">REP
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">REP_PARENT </span><span style="color: blue;">on </span><span style="color: teal;">REP_PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSource DS </span><span style="color: blue;">on </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">ItemID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DS_C </span><span style="color: blue;">on </span><span style="color: teal;">DS_C</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">Link
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DS_PARENT </span><span style="color: blue;">on </span><span style="color: teal;">DS_PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DS_C</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: blue;">where </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: blue;">Type </span><span style="color: gray;">= </span>2 <span style="color: green;">--report
    </span><span style="color: gray;">and </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">like </span><span style="color: red;">'/Awesome Reports/%'
</span><span style="color: blue;">order by </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: teal;">Name </span><span style="color: blue;">asc</span><span style="color: gray;">, </span><span style="color: teal;">DS</span><span style="color: gray;">.</span><span style="color: teal;">Name </span><span style="color: blue;">asc

</span><span style="color: green;">--generate LinkReportToDataset commands
</span><span style="color: blue;">SELECT </span><span style="color: red;">'%RS% -i "%SCRIPTLOCATION%\LinkReportToDataset.rss" -s %REPORTSERVER% -l %TIMEOUT% -e %ENDPOINT% -v reportName="'
    </span><span style="color: gray;">+ </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: teal;">Name </span><span style="color: gray;">+ </span><span style="color: red;">'" -v reportLocation="' </span><span style="color: gray;">+ </span><span style="color: teal;">REP_PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">+ </span><span style="color: red;">'" -v datasetName="'
    </span><span style="color: gray;">+ </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">Name </span><span style="color: gray;">+ </span><span style="color: red;">'" -v datasetLocation="' </span><span style="color: gray;">+ </span><span style="color: teal;">DSET_PARENT</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">+ </span><span style="color: red;">'"'
</span><span style="color: blue;">from </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog AS </span><span style="color: teal;">REP
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">REP_PARENT </span><span style="color: blue;">on </span><span style="color: teal;">REP_PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: teal;">DataSets </span><span style="color: blue;">AS </span><span style="color: teal;">DSET </span><span style="color: blue;">ON </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">ItemID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DSET_C </span><span style="color: blue;">on </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET</span><span style="color: gray;">.</span><span style="color: teal;">LinkID
</span><span style="color: gray;">inner join </span><span style="color: teal;">dbo</span><span style="color: gray;">.</span><span style="color: blue;">Catalog </span><span style="color: teal;">DSET_PARENT </span><span style="color: blue;">on </span><span style="color: teal;">DSET_PARENT</span><span style="color: gray;">.</span><span style="color: teal;">ItemID </span><span style="color: gray;">= </span><span style="color: teal;">DSET_C</span><span style="color: gray;">.</span><span style="color: teal;">ParentID
</span><span style="color: blue;">where </span><span style="color: teal;">REP</span><span style="color: gray;">.</span><span style="color: blue;">Path </span><span style="color: gray;">like </span><span style="color: red;">'/Awesome Reports/%'
</span></pre>
<p>And here’s the output:</p>
<p><a href="http://blog.hoegaerden.be/wp-content/uploads/image567.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="Generating the RS commands" src="http://blog.hoegaerden.be/wp-content/uploads/image_thumb111.png" border="0" alt="Generating the RS commands" width="700" height="120" /></a></p>
<h2>Conclusion</h2>
<p>It may not be a recommended practice to use the Reporting Services system tables, but as long as you’re only reading them and you keep in mind that your code may break in a next version of SQL Server, they can surely be useful!</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F02%2F16%2Fssrs-deployment-generate-the-batch-script-through-sql%2F&amp;title=SSRS%20Deployment%3A%20Generate%20The%20Batch%20Script%20Through%20SQL%21" id="wpa2a_16"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=7stl7LyvvOk:yP-eNKyFwGU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=7stl7LyvvOk:yP-eNKyFwGU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=7stl7LyvvOk:yP-eNKyFwGU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=7stl7LyvvOk:yP-eNKyFwGU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=7stl7LyvvOk:yP-eNKyFwGU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=7stl7LyvvOk:yP-eNKyFwGU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=7stl7LyvvOk:yP-eNKyFwGU:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=7stl7LyvvOk:yP-eNKyFwGU:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=7stl7LyvvOk:yP-eNKyFwGU:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/7stl7LyvvOk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/02/16/ssrs-deployment-generate-the-batch-script-through-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/02/16/ssrs-deployment-generate-the-batch-script-through-sql/</feedburner:origLink></item>
		<item>
		<title>Connecting Shapes In Word</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/XWGDUSrSUik/</link>
		<comments>http://blog.hoegaerden.be/2013/02/16/connecting-shapes-in-word/#comments</comments>
		<pubDate>Sat, 16 Feb 2013 13:00:00 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Office]]></category>
		<category><![CDATA[Word]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/02/16/connecting-shapes-in-word/</guid>
		<description><![CDATA[The other day I needed to draw a quick flow chart while I was writing some documentation.&#160; I didn’t want to go through the trouble of opening up Visio to do that – in fact, the computer on which I was doing this didn’t even have Visio installed – and decided to give the shapes [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I needed to draw a quick flow chart while I was writing some documentation.&#160; I didn’t want to go through the trouble of opening up Visio to do that – in fact, the computer on which I was doing this didn’t even have Visio installed – and decided to give the shapes in Word a try.&#160; And it wasn’t even a real <a title="Flowchart" href="http://en.wikipedia.org/wiki/Flowchart" target="_blank">flow chart</a> which I needed, I just wanted some boxes with text that could be connected using arrows.</p>
<p><em>The screenshots in this post are created using Microsoft Word 2010.</em></p>
<p>So I used the <strong>Shapes</strong> dropdown from the <strong>Insert</strong> menu to add two Rounded Rectangles to my document.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px; padding-top: 0px" title="Adding shapes to a Word document" border="0" alt="Adding shapes to a Word document" src="http://blog.hoegaerden.be/wp-content/uploads/image568.png" width="517" height="289" /></p>
<p>From that same menu, I used the arrow (second item in the Lines items) and tried to connect the two rectangles, ending up with this:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Arrow doesn&#39;t stick to the rectangles" border="0" alt="Arrow doesn&#39;t stick to the rectangles" src="http://blog.hoegaerden.be/wp-content/uploads/image569.png" width="229" height="222" /></p>
<p>Okay, I dragged the rectangles around a bit for demonstration purposes, but I’m sure you can all see that the arrow is not connected to the boxes.&#160; I couldn’t find any way to get these items to connect with each other!</p>
<p>I almost gave up but then I thought:</p>
<blockquote><p><font color="#404040">Hang on, it can’t be that they’ve implemented this functionality to make it as useless as this, right??</font></p>
</blockquote>
<p>So I decided to have a quick internet search and was glad to have found a solution.&#160; It turned out that I skipped a step.&#160; Apparently, to be able to connect shapes with each other, you first need to add a new Drawing Canvas to the document!&#160; That can be done using that same Shapes menu:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Adding a new Drawing Canvas to the Word document" border="0" alt="Adding a new Drawing Canvas to the Word document" src="http://blog.hoegaerden.be/wp-content/uploads/image570.png" width="269" height="657" /></p>
<p>After adding the Canvas, I repeated the process of adding rectangles and connecting them using an arrow, this time with more success!</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Use a drawing canvas to connect shapes with each other" border="0" alt="Use a drawing canvas to connect shapes with each other" src="http://blog.hoegaerden.be/wp-content/uploads/image571.png" width="481" height="386" /></p>
<p>&#160;</p>
<p>Many thanks to Nicholas Hebb for writing this <a title="How to Create a Flowchart in Word 2007 and Word 2010" href="http://www.breezetree.com/articles/how-to-flowchart-in-word.htm" target="_blank">How to Create a Flowchart in Word 2007 and Word 2010</a>.&#160; Check out his article for more tips on flowcharting in Word!</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F02%2F16%2Fconnecting-shapes-in-word%2F&amp;title=Connecting%20Shapes%20In%20Word" id="wpa2a_18"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=XWGDUSrSUik:AB3AEdD-KSs:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=XWGDUSrSUik:AB3AEdD-KSs:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=XWGDUSrSUik:AB3AEdD-KSs:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=XWGDUSrSUik:AB3AEdD-KSs:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=XWGDUSrSUik:AB3AEdD-KSs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=XWGDUSrSUik:AB3AEdD-KSs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=XWGDUSrSUik:AB3AEdD-KSs:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=XWGDUSrSUik:AB3AEdD-KSs:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=XWGDUSrSUik:AB3AEdD-KSs:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/XWGDUSrSUik" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/02/16/connecting-shapes-in-word/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/02/16/connecting-shapes-in-word/</feedburner:origLink></item>
		<item>
		<title>Automating SSRS Deployment: Download</title>
		<link>http://feedproxy.google.com/~r/BiBeerIntelligence/~3/tWh9q5mGuw4/</link>
		<comments>http://blog.hoegaerden.be/2013/01/30/automating-ssrs-deployment-download/#comments</comments>
		<pubDate>Wed, 30 Jan 2013 18:50:21 +0000</pubDate>
		<dc:creator>Valentino Vranken</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Reporting Services]]></category>
		<category><![CDATA[Community Event]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[SQLUG]]></category>

		<guid isPermaLink="false">http://blog.hoegaerden.be/2013/01/30/automating-ssrs-deployment-download/</guid>
		<description><![CDATA[As promised yesterday during my SQLUG presentation on Automating SSRS Deployments Using Built-in SQL Server Tools, you can download the slides and demos through this link. Small disclaimer: you’re free to use the methods presented for your own projects, but I can’t allow that you use the material to deliver the presentation yourself.  Hope you [...]]]></description>
			<content:encoded><![CDATA[<p>As promised yesterday during my SQLUG presentation on <a href="http://blog.hoegaerden.be/2013/01/21/sqlug-automating-ssrs-deployments/" target="_blank">Automating SSRS Deployments Using Built-in SQL Server Tools</a>, you can <a href="https://skydrive.live.com/embed?cid=81C8B064CBBE1698&amp;resid=81C8B064CBBE1698%21161&amp;authkey=ABselTiDgnFIhcM" target="_blank">download the slides and demos through this link</a>.</p>
<p><em>Small disclaimer: you’re free to use the methods presented for your own projects, but I can’t allow that you use the material to deliver the presentation yourself.  Hope you understand.</em></p>
<p>Keep your eyes on this blog.  I’ll soon be describing a method which you can use to generate the batch files in order to fully automate the deploy process without using a custom .NET application!</p>
<p>Have fun!</p>
<p>Valentino.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.hoegaerden.be%2F2013%2F01%2F30%2Fautomating-ssrs-deployment-download%2F&amp;title=Automating%20SSRS%20Deployment%3A%20Download" id="wpa2a_20"><img src="http://blog.hoegaerden.be/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=tWh9q5mGuw4:VcU8VHMuFyI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=tWh9q5mGuw4:VcU8VHMuFyI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=tWh9q5mGuw4:VcU8VHMuFyI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=tWh9q5mGuw4:VcU8VHMuFyI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=tWh9q5mGuw4:VcU8VHMuFyI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=tWh9q5mGuw4:VcU8VHMuFyI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=tWh9q5mGuw4:VcU8VHMuFyI:3QFJfmc7Om4"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?i=tWh9q5mGuw4:VcU8VHMuFyI:3QFJfmc7Om4" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/BiBeerIntelligence?a=tWh9q5mGuw4:VcU8VHMuFyI:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/BiBeerIntelligence?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/BiBeerIntelligence/~4/tWh9q5mGuw4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.hoegaerden.be/2013/01/30/automating-ssrs-deployment-download/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.hoegaerden.be/2013/01/30/automating-ssrs-deployment-download/</feedburner:origLink></item>
	</channel>
</rss>
