<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Bob's SQL Reporting Services Blog : Tricks</title><link>http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx</link><description>Tags: Tricks</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Add Excel-like "color scale" conditional formatting to your reports</title><link>http://blogs.msdn.com/bobmeyers/archive/2009/07/31/add-excel-like-color-scale-conditional-formatting-to-your-reports.aspx</link><pubDate>Sat, 01 Aug 2009 03:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9854833</guid><dc:creator>bobmeyers</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/9854833.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=9854833</wfw:commentRss><description>&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;I’ve been meaning to do this for a long time, and it looks like David Lean &lt;A href="http://blogs.msdn.com/davidlean/archive/2009/02/17/sql-reporting-how-to-conditional-color-1-4-the-basics-report-expressions-custom-code.aspx" mce_href="http://blogs.msdn.com/davidlean/archive/2009/02/17/sql-reporting-how-to-conditional-color-1-4-the-basics-report-expressions-custom-code.aspx"&gt;beat me to it&lt;/A&gt; earlier this year by posting an incredibly thorough four-part discussion of how to do &lt;B style="mso-bidi-font-weight: normal"&gt;conditional formatting in Reporting Services&lt;/B&gt;. I’ve played with his sample code a bit and put together a variation on his theme that meets some additional requirements, which I have found helpful.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;The attached sample code is designed to provide the following functionality (the usual disclaimers apply):&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Convenient support for the &lt;B style="mso-bidi-font-weight: normal"&gt;standard color scales&lt;/B&gt; available in Excel 2007&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Support for &lt;B style="mso-bidi-font-weight: normal"&gt;arbitrary colors&lt;/B&gt;, including named colors (“MintCream”)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Robust handling of &lt;B style="mso-bidi-font-weight: normal"&gt;null, error, and out-of-range &lt;/B&gt;values&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: Symbol; FONT-SIZE: 10pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;·&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Robust handling of all &lt;B style="mso-bidi-font-weight: normal"&gt;integral &lt;/B&gt;and&lt;B style="mso-bidi-font-weight: normal"&gt; floating point&lt;/B&gt; numeric types&lt;B style="mso-bidi-font-weight: normal"&gt; &lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;To use them in a report, do the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpFirst&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Open the &lt;B style="mso-bidi-font-weight: normal"&gt;Report Properties&lt;/B&gt; dialog (right-click on the space around the report body, choose Report Properties)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpMiddle&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;On the &lt;B style="mso-bidi-font-weight: normal"&gt;Code&lt;/B&gt; page, paste in the attached code&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class=MsoListParagraphCxSpLast&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;On the &lt;B style="mso-bidi-font-weight: normal"&gt;References&lt;/B&gt; page, add a reference, click Browse, locate and select System.Drawing.dll, usually in C:\Windows\Microsoft.NET\Framework\v2.0.50727 (this references allows the code to handle named colors)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;The simplest and most common usage of these functions is to create a red-yellow-green&lt;B style="mso-bidi-font-weight: normal"&gt; “heat map”&lt;/B&gt; based on the value being displayed in the text box. This is done by setting the text box’s Fill color to an expression similar to the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;=Code.ColorScaleRYG(Sum(Fields!SalesAmount.Value), 0, 100000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;The arguments 0 and 100000 are the &lt;B style="mso-bidi-font-weight: normal"&gt;min&lt;/B&gt; and &lt;B style="mso-bidi-font-weight: normal"&gt;max&lt;/B&gt; values for the color scale. In this case, the &lt;B style="mso-bidi-font-weight: normal"&gt;ColorScaleRYG&lt;/B&gt; function is used, which assigns red to the low value, green to the high value, and yellow to the value half-way in between. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;The min and max values can also be &lt;B style="mso-bidi-font-weight: normal"&gt;calculated&lt;/B&gt;, like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt 0.5in" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;=Code.ColorScaleRYG(Sum(Fields!SalesAmount.Value), Min(Fields!SalesAmount.Value, “Dataset1”), Max(Fields!SalesAmount.Value), “Dataset1”))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;The argument “Dataset1” defines the &lt;A href="http://msdn.microsoft.com/en-us/library/ms159673.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms159673.aspx"&gt;scope&lt;/A&gt; in which the min or max value is calculated, which must be a parent scope of the current scope.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Note that these colors are not the pure “Red”, “Green”, and “Yellow” colors defined in HTML/.NET/SSRS, but rather the default values used in Excel which are intended to provide a &lt;B style="mso-bidi-font-weight: normal"&gt;reasonable background&lt;/B&gt; for black text. If you don’t like them, it’s easy to specify your own colors instead.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Here’s a full list of the functions provided:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Convenience functions for standard 3-color scales&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleRYG(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleGYR(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleRYB(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleBYR(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleRWB(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleBWR(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Convenience functions for standard 2-color scales&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleRY(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleYR(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleGY(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScaleYG(value, minValue, maxValue) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Arbitrary 3-color scale with interpolated midpoint value&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScale3(value as object, minValue as object, minColor as string, midColor as string, maxValue as object, maxColor as string) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Arbitrary 3-color scale with explicit midpoint value&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScale3(value as object, minValue as object, minColor as string, midValue as object, midColor as string, maxValue as object, maxColor as string) as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;‘ Arbitrary 2-color scale with optional error color (the core function)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;public function ColorScale(value as object, minValue as object, minColor as string, maxValue as object, maxColor as string, optional errorColor as string = "Transparent") as string&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; FONT-SIZE: 10pt; mso-bidi-font-size: 11.0pt"&gt;Enjoy!&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9854833" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/bobmeyers/attachment/9854833.ashx" length="4912" type="text/plain" /><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Builder/default.aspx">Report Builder</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Presentation/default.aspx">Presentation</category></item><item><title>Localizing a report model</title><link>http://blogs.msdn.com/bobmeyers/archive/2009/04/27/localizing-a-report-model.aspx</link><pubDate>Tue, 28 Apr 2009 02:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9572398</guid><dc:creator>bobmeyers</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/9572398.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=9572398</wfw:commentRss><description>&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Reports and report models can be localized at many levels. Following are some ideas around the current support in SQL Server 2008 for each type of localization.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Localized metadata at report design time&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Example&lt;/B&gt;: Spanish report author sees “Cliente” instead of “Customer” in model explorer&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Report models do not support multiple languages for metadata names in a single model file&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;It should not be difficult to build a custom solution to generate localized versions of the model file&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: -0.25in; mso-list: l0 level3 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;§&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Original .smdl file + XML file with localized entity/attribute/role names =&amp;gt; localized .smdl file&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: -0.25in; mso-list: l0 level3 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;§&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Could use either XSLT or minimal code&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;If implemented, reports would run against any localized version of the model because IDs are unchanged&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Metadata displayed in the report (such as column labels) would be in the language of the person who designed the report. Since they are merely text values copied in from the model explorer, they would &lt;B style="mso-bidi-font-weight: normal"&gt;not&lt;/B&gt; change at report run time.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Localized metadata at report run time&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Example:&lt;/B&gt; Spanish report consumer sees “Cliente” instead of “Customer” in report column label&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;SQL RS reports do not directly support localization of text labels in a report&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Some customers have implemented this using a custom “resource” assembly deployed on the server, and all labels in the report are replaced at report design time with expressions that retrieve the appropriate resource string from the custom assembly (&lt;A class="" title=sample href="http://www.codeproject.com/KB/reporting-services/SSRSReportLocalized.aspx" mce_href="http://www.codeproject.com/KB/reporting-services/SSRSReportLocalized.aspx"&gt;sample&lt;/A&gt;&lt;/FONT&gt;&lt;FONT face=Calibri size=3&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;This is obviously cumbersome to set up at report design time, but it does work&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Localized data formatting at report run time&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Example&lt;/B&gt;: Spanish report consumer sees numeric and date values in the report data formatted as “1.234,56” and “27/04/2009” instead of "1,234.56" and "04/27/2009".&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;This is supported by the default number formats available on the ribbon in Report Builder 2.0. In the dialog box, select the “Use regional formatting” checkbox.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-bidi-font-family: Calibri; mso-fareast-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Localized data values at report run time&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Example&lt;/B&gt;: Spanish report consumer sees product category “Bicicletas” instead of “Bicycles” in report data&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;This is typically done by storing localized values in the database as separate columns or as lookup tables based on user culture.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Offhand I can’t think of a slick way to do this with report models. If you have some ideas, &lt;A class="" title="let me know" href="http://blogs.msdn.com/bobmeyers/contact.aspx" mce_href="http://blogs.msdn.com/bobmeyers/contact.aspx"&gt;let me know&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9572398" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Design/default.aspx">Model Design</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Localization/default.aspx">Localization</category></item><item><title>Sorting the values in parameter dropdowns in Report Builder</title><link>http://blogs.msdn.com/bobmeyers/archive/2007/10/11/sorting-the-values-in-parameter-dropdowns-in-report-builder.aspx</link><pubDate>Thu, 11 Oct 2007 11:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5399498</guid><dc:creator>bobmeyers</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/5399498.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=5399498</wfw:commentRss><description>&lt;P&gt;In SQL 2005 the semantic queries generated by Report Builder do not support sorting. This is not a problem in the report itself, because all sorting is defined and implemented in the report definition instead of the query. However, for parameter dropdowns there is currently no solution: if the query doesn't sort the data, there's no way in RDL to define the sort you want. As a result, the values in your parameter dropdowns will sometimes be scrambled.&lt;/P&gt;
&lt;P&gt;If you are interested, the attached C# project contains an updated version of the custom data processing extension I shared in a &lt;A class="" title="earlier hack" href="http://blogs.msdn.com/bobmeyers/archive/2006/10/31/enforcing-timeouts-on-report-builder-queries.aspx" mce_href="http://blogs.msdn.com/bobmeyers/archive/2006/10/31/enforcing-timeouts-on-report-builder-queries.aspx"&gt;previous post&lt;/A&gt; for enforcing query timeouts, This version adds the ability to recognize lookup queries generated by Report Builder (e.g. those generated for parameter dropdowns), and append an appropriate ORDER BY clause to get the data back in the right order. Since the order of the result data is not defined in this release, it should not break anything, and since it uses a very strict Regex to recognize the lookup queries, it should not affect performance of any other queries. This implementation will sort dropdown items in exactly the same order as they appear in the Filter dialog in Report Builder, whether they are attribute values or entity instances (including the use of an entity's SortAttributes if defined).&lt;/P&gt;
&lt;P&gt;To try out the sample, download the attached ZIP file and follow the same instructions as before, Please note that, as I mentioned before,&amp;nbsp;this approach exercises an &lt;STRONG&gt;unsupported&lt;/STRONG&gt; feature, so if you run into problems and ask MS Support for help, they will tell you to go jump in&amp;nbsp;a lake. :)&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5399498" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/bobmeyers/attachment/5399498.ashx" length="9234" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Builder/default.aspx">Report Builder</category></item><item><title>Requiring Report Builder users to choose a perspective</title><link>http://blogs.msdn.com/bobmeyers/archive/2007/02/27/requiring-report-builder-users-to-choose-a-perspective.aspx</link><pubDate>Tue, 27 Feb 2007 22:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1770358</guid><dc:creator>bobmeyers</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/1770358.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=1770358</wfw:commentRss><description>&lt;P&gt;Some customers have report models that are large enough they do not expect any user to ever request the entire model, and would actually prefer to disallow that option, and require them to choose a perspective instead. There is an undocumented and unsupported feature that provides this behavior in the current release. It is used by Analysis Services when generating a report model over a cube.&lt;/P&gt;
&lt;P&gt;The simplest approach is to use the SOAP API's to add a custom property to the report model with name = "MustUsePerspective" and value = "true".&lt;/P&gt;
&lt;P&gt;If you wish, you can add a similar custom property to the report model within Model Designer, set the property data type to Boolean, set the namespace to&amp;nbsp;"http://schemas.microsoft.com/sqlserver/2004/11/semanticquerydesign", and whenever you publish the model the corresponding server property will be added automatically.&lt;FONT color=#a31515 size=1&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1770358" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Builder/default.aspx">Report Builder</category></item><item><title>Launching Report Builder from the command line</title><link>http://blogs.msdn.com/bobmeyers/archive/2007/02/22/launching-report-builder-from-the-command-line.aspx</link><pubDate>Fri, 23 Feb 2007 03:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1744508</guid><dc:creator>bobmeyers</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/1744508.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=1744508</wfw:commentRss><description>&lt;P&gt;A number of people have asked if it is possible to launch RB from the command line. While it is in fact possible, it is an &lt;STRONG&gt;unsupported&lt;/STRONG&gt; feature in SQL Server 2005. That said, here's how&amp;nbsp;to&amp;nbsp;do it. You just need to specify what report server to connect to, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReportBuilder.exe /s=http://mybox/reportserver&lt;/P&gt;
&lt;P&gt;Other supported URL parameters are also recognized when passed on the command line, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReportBuilder.exe /s=http://localhost/reportserver "/My Favorite Report"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReportBuilder.exe /s=http://localhost/reportserver "/model=/Models/Adventure Works"&lt;/P&gt;
&lt;P&gt;Again, this feature is &lt;STRONG&gt;not &lt;/STRONG&gt;supported in this release. If you run into problems and call MS product support, they will tell you to go jump in a lake. :)&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1744508" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Builder/default.aspx">Report Builder</category></item><item><title>Enforcing timeouts on Report Builder queries</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/10/31/enforcing-timeouts-on-report-builder-queries.aspx</link><pubDate>Tue, 31 Oct 2006 22:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:916254</guid><dc:creator>bobmeyers</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/916254.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=916254</wfw:commentRss><description>&lt;P&gt;I've attached a sample C# project illustrating how to create a custom data processing extension&amp;nbsp;(&lt;A title=more href="http://msdn2.microsoft.com/en-us/library/aa237575(SQL.80).aspx" target=_blank mce_href="http://msdn2.microsoft.com/en-us/library/aa237575(SQL.80).aspx"&gt;more info&lt;/A&gt;) that enforces a maximum timeout on any SQL queries submitted to it, &lt;EM&gt;including&lt;/EM&gt; those generated from Report Builder.&lt;/P&gt;
&lt;P&gt;To try it out:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Open and build the attached C# project in VS.&lt;/LI&gt;
&lt;LI&gt;Copy output assembly to the ...\ReportServer\bin folder.&lt;/LI&gt;
&lt;LI&gt;Add the config entries indicated in the NewConfigEntries.txt file (included in the project).&lt;/LI&gt;
&lt;LI&gt;Use Report Manager to edit the properties for the data source your report model is bound to, and change the connection type to "Microsoft SQL Server (timeout)".&lt;/LI&gt;
&lt;LI&gt;Run a report against the report model that has a long-running query.&lt;/LI&gt;
&lt;LI&gt;Notice that the database query and report processing are cancelled after the timeout specified in the config file. This occurs regardless of the setting in the report (which RB always sets to 0=infinite).&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Because mapping the SQL semantic query&amp;nbsp;engine&amp;nbsp;to something other than the built-in SQL data extension is technically not supported, the proverbial disclaimer applies: If you try this at home and it works, great; if something bad happens and you ask MS product support to fix it for you, they will tell you to go jump in a lake.&lt;/P&gt;
&lt;P&gt;That said, hopefully some will find this helpful.&lt;/P&gt;
&lt;P&gt;UPDATE: The new config entries identified in the attached file are based on a recent internal SP2 build. If you aren't running SP2 (not likely, since it hasn't been released yet), ignore the SemanticQuery entry and just copy your existing one, changing the name attribute to match the name of the new custom data extension.&lt;/P&gt;
&lt;P&gt;UPDATE 5/8/2009: Updated attachment to fix issue in SQL 2005 SP3 and SQL 2008 (need to implement IDbConnectionWrapper). I updated the policy config entry to use the default install location for SQL 2008, and&amp;nbsp;upgraded the project file to VS 2008. Thanks to &lt;A title=hawdong href="http://blogs.msdn.com/user/Profile.aspx?UserID=180902" mce_href="http://blogs.msdn.com/user/Profile.aspx?UserID=180902"&gt;hawdong&lt;/A&gt; for pointing out the issue.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=916254" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/bobmeyers/attachment/916254.ashx" length="4939" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Builder/default.aspx">Report Builder</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Scale/default.aspx">Scale</category></item><item><title>Creating a report model that can be used against multiple databases</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/09/28/creating-a-report-model-that-can-be-used-against-multiple-databases.aspx</link><pubDate>Thu, 28 Sep 2006 21:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:775833</guid><dc:creator>bobmeyers</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/775833.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=775833</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Sometimes it is useful to create a report model that can be used against multiple databases that have the same structure, but reside on different servers and/or have different schema qualifiers.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Uploading a second copy of a report model and pointing it at a different database is certainly easy enough, but you can run into issues if the second database has different schema qualifiers. The problem is that, by default, the Data Source View wizard creates a DSV that &lt;EM&gt;includes &lt;/EM&gt;schema qualifiers in the bindings. If those qualifiers are not necessary (i.e. the bindings&amp;nbsp;can be fully resolved if a default database is specified in your data source connection string), you can make your report model work for the second database by opening the .dsv file in a text editor and use Find/Replace to simply remove all the schema qualifiers.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Test it out against the old and new databases, and you should be good to go.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=775833" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Design/default.aspx">Model Design</category></item><item><title>How to get the SQL for a Report Builder report</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/07/05/how-to-get-the-sql-for-a-report-builder-report.aspx</link><pubDate>Wed, 05 Jul 2006 21:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:657125</guid><dc:creator>bobmeyers</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/657125.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=657125</wfw:commentRss><description>&lt;FONT face=Arial size=2&gt;
&lt;P&gt;There are two ways to get the generated SQL for a Report Builder report (or for a model-based query in any RS report): 1) use SQL Profiler to capture the incoming SQL commands, or 2) enable query logging in the report server.&lt;/P&gt;
&lt;P&gt;To enable query logging on the report server (option #2), make the following change to&amp;nbsp;the &lt;STRONG&gt;web.cofig &lt;/STRONG&gt;file in your ReportServer install directory:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Before:&lt;BR&gt;&lt;/STRONG&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;BR&gt;&amp;lt;configuration&amp;gt;&lt;BR&gt;&amp;nbsp; ...&lt;BR&gt;&amp;nbsp; &amp;lt;RStrace&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="Components" value="all,RunningJobs:3,SemanticQueryEngine:&lt;STRONG&gt;&lt;FONT color=#ff0000&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;,SemanticModelGenerator:2" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/RStrace&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;After:&lt;BR&gt;&lt;/STRONG&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;BR&gt;&amp;lt;configuration&amp;gt;&lt;BR&gt;&amp;nbsp; ...&lt;BR&gt;&amp;nbsp; &amp;lt;RStrace&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="Components" value="all,RunningJobs:3,SemanticQueryEngine:&lt;FONT color=#ff0000&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/FONT&gt;,SemanticModelGenerator:2" /&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/RStrace&amp;gt;&lt;/P&gt;
&lt;P&gt;You can then run a report and you will find the corresponding SQL statement in the log file at:&lt;/P&gt;
&lt;P&gt;...\Reporting Services\LogFiles\ReportServer_&amp;lt;datetime&amp;gt;.log&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=657125" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Admin/default.aspx">Admin</category></item><item><title>Using RDL expressions in Report Builder</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/03/26/using-rdl-expressions-in-report-builder.aspx</link><pubDate>Sun, 26 Mar 2006 05:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:561147</guid><dc:creator>bobmeyers</dc:creator><slash:comments>13</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/561147.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=561147</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;While not a documented feature, you actually &lt;EM&gt;can &lt;/EM&gt;enter an arbitrary RDL expression into a textbox&amp;nbsp;in a&amp;nbsp;Report Builder report.&amp;nbsp;For example, you&amp;nbsp;could&amp;nbsp;add a textbox&amp;nbsp;that shows the date the report was run by setting the value of the textbox to the following:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT face=Arial size=2&gt;=String.Format("Date:&amp;nbsp;{0:MM/dd/yyyy}",&amp;nbsp;DateTime.Today)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Another&amp;nbsp;potential use of this undocumented feature is to display the values selected by the user for each report parameter. This is a helpful workaround for the fact that the auto-generated filter description does not insert the run-time values for each parameter. Here's an example of an RDL expression that would provide this info:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT face=Arial size=2&gt;=String.Format("Sales Year: {0}", Parameters!OrderYear.Value)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Note that you will have to guess the name of the report parameter generated by Report Builder. Typically it will be the name of the field used in the prompted filter condition, with any spaces removed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;You cannot enter an RDL expression directly into a detail or subtotal cell in a table or matrix.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=561147" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Report+Design/default.aspx">Report Design</category></item><item><title>How to create a 'company' security filter for a hosted application</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/03/24/how-to-create-a-quot-company-quot-security-filter-for-a-hosted-application.aspx</link><pubDate>Sat, 25 Mar 2006 04:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:560200</guid><dc:creator>bobmeyers</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/560200.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=560200</wfw:commentRss><description>&lt;P&gt;&lt;FONT size=2 face=Arial&gt;Several customers have asked how to restrict data visibility in a report model for a hosted application, where every table has a "CompanyID" column, and every user that accesses the system is associated (via some other table) with exactly one company. The straightforward solution is to &lt;A href="http://blogs.msdn.com/bobmeyers/articles/Implementing_Data_Security_in_a_Report_Model.aspx" mce_href="http://blogs.msdn.com/bobmeyers/articles/Implementing_Data_Security_in_a_Report_Model.aspx"&gt;create a security filter&lt;/A&gt;&amp;nbsp;on each corresponding entity; the filter should check whether any rows exist in the user table entity where Users.CompanyID=This.CompanyID and UserTable.UserID=GETUSERID(). This will work, but the SQL that is generated for this filter may not be optimal.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;An alternative is to modify the DSV for the report model such that each table containing a CompanyID is really a named query of the form:&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;SELECT t.*, u.UserID FROM MyTable t, UserTable u WHERE t.CompanyID = u.CompanyID&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;Note that this derived table contains &lt;EM&gt;n &lt;/EM&gt;rows for each row in MyTable, where &lt;EM&gt;n &lt;/EM&gt;is the number of users associated with that row's company. To effectively fool the model, you will need to lie in the DSV and claim that the primary key of your derived table is composed of &lt;EM&gt;only &lt;/EM&gt;the key columns for MyTable.&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;You must then create a security filter on the corresponding model entity for MyTable, which simply states UserID = GETUSERID(). If you create any other security filters for that entity, they MUST contain the same filter condition, in addition to any other conditions. No user should be given access to all the rows of that entity.&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;This approach, while a bit of a hack, should result in much better SQL at runtime. &lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2 face=Arial&gt;&lt;STRIKE&gt;Credits to my illustrious colleague &lt;/STRIKE&gt;&lt;A href="http://blogs.msdn.com/chrishays/" mce_href="http://blogs.msdn.com/chrishays/"&gt;&lt;STRIKE&gt;Chris Hays&lt;/STRIKE&gt;&lt;/A&gt;&lt;STRIKE&gt; for coming up with this.&lt;/STRIKE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;: The alternative proposed above does not work correctly in all cases because of an optimization we do in the SQL translation layer. Best practice is to stick with the "straightforward solution" described at the beginning of the post.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=560200" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Schema/default.aspx">Schema</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Design/default.aspx">Model Design</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Security/default.aspx">Model Security</category></item><item><title>Collapsing a many-to-many relationship in a report model</title><link>http://blogs.msdn.com/bobmeyers/archive/2006/03/24/collapsing-a-many-to-many-relationship-in-a-report-model.aspx</link><pubDate>Fri, 24 Mar 2006 21:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:560255</guid><dc:creator>bobmeyers</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/560255.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=560255</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Often a many-to-many relationship exists between two entities where the intermediate entity has nothing on it except the connecting roles. For example, it might be that an Employee can be assigned to many Regions, and each Region can have many Employees assigned to it, but&amp;nbsp;there&amp;nbsp;is nothing interesting about an Employee Region (the intermediate entity).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;In such cases, you can effectively hide the intermediate entity from your users by doing something like the following, where the three entities involved are A -&amp;lt; B &amp;gt;- C:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;1. Rename the role from&amp;nbsp;A to&amp;nbsp;B as "Cs"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;2. Rename the role from C to B as "As"&lt;BR&gt;3. Set ExpandInline=True on the role from B to C&lt;BR&gt;4. Set ExpandInline=True on the role from B to A&lt;BR&gt;5. Add the role from B to A to the HiddenFields collection of the role from A to B&lt;BR&gt;6. Add the role from B to C to the HiddenFields collection of the role from C to B&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;BR&gt;7. Set Hidden=True on entity B&lt;BR&gt;8. Set Hidden=True &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;the # Bs attribute (or just delete it)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Once you've done this, entity B is effectively hidden from the user.&amp;nbsp;The only exception will be in the Formula dialog, where if the user displays the expanded formula for a field related via this path, the individual roles from A to B and B to C will be displayed. Other than that, as far as&amp;nbsp;a Report Builder user can tell entity B does not exist.&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=560255" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Schema/default.aspx">Schema</category><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Model+Design/default.aspx">Model Design</category></item><item><title>How to create an inline bar chart</title><link>http://blogs.msdn.com/bobmeyers/archive/2005/10/15/481342.aspx</link><pubDate>Sat, 15 Oct 2005 08:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:481342</guid><dc:creator>bobmeyers</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/bobmeyers/comments/481342.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bobmeyers/commentrss.aspx?PostID=481342</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;Here's a neat trick a co-worker and I discovered this afternoon for creating an &lt;STRONG&gt;inline bar chart &lt;/STRONG&gt;(an inline data visualization in a table or other data region).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;1. Add an embedded image to your report that will serve as the "bar" (a simple horizontal gradient usually looks nice)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;2. Add a column to your table, and place an Image report item in the detail row cell.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;3. Select the embedded image from step 1 as the source for the Image report item.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;4. Set the padding on the Image report item to adjust the size and position of the bar within the cell&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial color=#000080 size=2&gt;5. &lt;STRONG&gt;[Here's the kicker]&lt;/STRONG&gt; Create an expression for the right (or left) padding that divides a field value by some maximum value, clamps it to a given range if necessary using Math.Min/Max, and then multiplies by the total size of the bar.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial&gt;&lt;FONT color=#000080&gt;&lt;FONT size=2&gt;Example: &lt;/FONT&gt;&lt;FONT size=2&gt;image1.Padding.Right=((1.0-(Math.Min(Math.Max(Fields!TotalSales.Value,0),100000)/100000))*72) &amp;amp; "pt"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=481342" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bobmeyers/archive/tags/Tricks/default.aspx">Tricks</category></item></channel></rss>