<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>OOP - There It Is - Reporting Services</title>
    <link>http://www.vpsw.com/blogbaby/</link>
    <description>A Very Practical Blog</description>
    <language>en-us</language>
    <copyright>Dean Fiala</copyright>
    <lastBuildDate>Fri, 12 May 2006 03:30:15 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>dfiala@vpsw.com</managingEditor>
    <webMaster>dfiala@vpsw.com</webMaster>
    <item>
      <trackback:ping>http://www.vpsw.com/blogbaby/Trackback.aspx?guid=977e0b90-5e81-4f41-9147-140e03f3c0c9</trackback:ping>
      <pingback:server>http://www.vpsw.com/blogbaby/pingback.aspx</pingback:server>
      <pingback:target>http://www.vpsw.com/blogbaby/PermaLink,guid,977e0b90-5e81-4f41-9147-140e03f3c0c9.aspx</pingback:target>
      <dc:creator>Dean</dc:creator>
      <wfw:comment>http://www.vpsw.com/blogbaby/CommentView,guid,977e0b90-5e81-4f41-9147-140e03f3c0c9.aspx</wfw:comment>
      <wfw:commentRss>http://www.vpsw.com/blogbaby/SyndicationService.asmx/GetEntryCommentsRss?guid=977e0b90-5e81-4f41-9147-140e03f3c0c9</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I have been doing a little exploration
of <a href="http://www.microsoft.com/sql/technologies/reporting/default.mspx">Reporting
Services</a>.  It is a strange beast, especially after focusing on web development
for the past 6 or so years.  It straddles the desktop and web, and sometimes
I need to forcibly pull my head out of its web-first rut.<br /><br />
It has some very nice features when used in conjunction with the ReportViewer control
on a web page -- paging and export to Excel and PDF are built-in.  No code to
write, nothing to configure. It is an excellent replacement for "dumb" report pages
that just show a lot of data, but don't need to do much else.<br /><br />
The hardest mental hoop to jump through so far is that there are no CSS settings. 
I don't want to hard code fonts, colors, etc. for each textbox on the report, but
I have yet to discover a way around this.  I'm so used to CSS classes, which
make it easy to globably change how whole sites work with a few key strokes. To get
alternatiing colors in each row I set an expression for the background property like
so...<br /><br /><blockquote><font color="#ff0000" face="Courier New">=If(RowNumber(Nothing) mod 2
= 0, "#80C0FF", "White")</font><br /></blockquote><br />
Which is simple enough, and I can select all the text boxes in a report and set the
property for all of them, but if I have more than 2 reports and want to change the
alternating color or font, etc. for all of them -- it will get very dull, very fast.<br /><br />
 I'm thinking the way to do this is to set a code call for each textbox with
a parameter.  There is a facility to call functions for most (if not all) the
property settings.  So unless I can find a better "native" way, what I'll do
is write a method that returns the 
<br /><br /><blockquote><font color="#ff0000" face="Courier New">static string GetBackgroundColorFromClassName(string
ClassName)</font><br /><font color="#ff0000" face="Courier New">{</font><br /><font color="#ff0000" face="Courier New">    string BackgroundColor
="White"; //or some default color</font><br /><font color="#ff0000" face="Courier New">    if(ClassList.ContainsKey(ClassName))</font><br /><font color="#ff0000" face="Courier New">       BackgroundColor
= ClassList[ClassName];</font><br /><br /><font color="#ff0000" face="Courier New">    return BackgroundColor;</font><br /><font color="#ff0000" face="Courier New">}</font><br /></blockquote><br />
The ClassList in this case would be a NameValue collection. Would build  it from
a config file. Or maybe even rip it from the  css file.  Hmmm. Something
to investigate.<br /><br />
Then in the N TextBox Background color properties I'd change the code to something
like (i'm not sure of the exact syntax for referencing an external mehtod):<br /><br /><blockquote><font color="#ff0000" face="Courier New">=If(RowNumber(Nothing) mod 2
= 0, </font><font color="#ff0000" face="Courier New">GetBackgroundColorFromClassName("AltItem")</font><font color="#ff0000" face="Courier New">, </font><font color="#ff0000" face="Courier New">GetBackgroundColorFromClassName(</font><font color="#ff0000" face="Courier New">"Item"))</font><br /></blockquote><br />
Speaking of properties...<br /><br />
There is some minor foo going on in the report designer.  Select a text box in
a report, right-click and select Properties, a tabbed properties dialog box appears. 
Hit  the &lt;F4&gt; key instead and the ubiquitous properties window appears. 
There is some overlap, but there are also differences in what properties are available
from each view and in how they are organized. At least the tabbed dialog can be accessed
from the properties window by clicking on the last button on the top the window (the
icon does resemble a tabbed dialog box with a bit of squinting).<br /><br />
It is confusing the first couple of times searching for where to set something. I've
trained myself to hit &lt;F4&gt; because the properties window displays everything
that is available in one view.  Definitely beats hunting through the tabs. 
<br /><br />
And Now To Hyperlinks...<br /><br />
One of the glorious things about the web -- actually the foundation of its very usefulness
-- is the hyperlink.  The ability to dash off to something else of interest with
a simple click is so common, I think we take for granted how revolutionary the idea
was.  Using hyperlinks in straight html reports is done without thought. 
And fortunately, Reporting Services does in fact allow for their existence. 
The <a href="http://msdn2.microsoft.com/en-us/library/ms252126.aspx">Action Property</a> of
the TextBox is where the ability to add a hyperlink is hidden.  Selecting "Jump
To URL" and adding a URL does just what you'd want it to do.  You'll have to
add some custom code to use app paths, etc.  But for static URLs it is very straightforward.<br /><br />
There is one trifling annoyance, though the hyperlink is created easily, it is not
styled as a hyperlink when the report renders.  I manually did so with the color
and text decoration properties.  I want my CSS.  Didn't realize how much
I would miss it, stepping away from it ever so slightly.<br /><br />
Firefox's One Character Columns...<br /><br />
While Reporting Services does render reports in Firefox without too much kicking and
screaming, it does <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=83194&amp;SiteID=1">collapse
all the columns to one character width</a>.  Very efficient use of horizontal
space, but annoying for everything but <a href="http://en.wikipedia.org/wiki/Sodoku">sodoku</a> output. 
There is a workaround in the forum linked to above -- a hidden textbox with a fixed
width across the entire report keeps it from collapsing in Firefox.<br /><br />
Finally, Data Sources and Temp Tables...<br /><br />
I always work with stored procedures, and Reporting Services supports using them as
Data Sources.  Visual Studio even has a wizard for creating a table adapter to
wrap around a stored procedure. This works very well and makes it easy drag the output
columns into the report. However, if the stored procedure is selecting from a temp
table, then the table adpater won't work.  The error returned is that #SomeTempTable
is undefined.  Which is perfectly true.  It dies when the stored procedure
completes, but the output ifrom the procedure is still there!  Smells like bad
encapsualtion to me.  It shouldn't matter how the table is created, something
is peeking too deep.  The workaround, of course, is to create a real table that
matches the output for the purposes of the data adapter and designer.  At run
time, the data table created from the stored procedure is added dynamically as the
Data Source and the report does not give a hoot how it was created. 
<br /><br /><p></p><img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=977e0b90-5e81-4f41-9147-140e03f3c0c9" /></body>
      <title>Report Services - Quirks</title>
      <guid isPermaLink="false">http://www.vpsw.com/blogbaby/PermaLink,guid,977e0b90-5e81-4f41-9147-140e03f3c0c9.aspx</guid>
      <link>http://www.vpsw.com/blogbaby/PermaLink,guid,977e0b90-5e81-4f41-9147-140e03f3c0c9.aspx</link>
      <pubDate>Fri, 12 May 2006 03:30:15 GMT</pubDate>
      <description>I have been doing a little exploration of &lt;a href="http://www.microsoft.com/sql/technologies/reporting/default.mspx"&gt;Reporting
Services&lt;/a&gt;.&amp;nbsp; It is a strange beast, especially after focusing on web development
for the past 6 or so years.&amp;nbsp; It straddles the desktop and web, and sometimes
I need to forcibly pull my head out of its web-first rut.&lt;br&gt;
&lt;br&gt;
It has some very nice features when used in conjunction with the ReportViewer control
on a web page -- paging and export to Excel and PDF are built-in.&amp;nbsp; No code to
write, nothing to configure. It is an excellent replacement for "dumb" report pages
that just show a lot of data, but don't need to do much else.&lt;br&gt;
&lt;br&gt;
The hardest mental hoop to jump through so far is that there are no CSS settings.&amp;nbsp;
I don't want to hard code fonts, colors, etc. for each textbox on the report, but
I have yet to discover a way around this.&amp;nbsp; I'm so used to CSS classes, which
make it easy to globably change how whole sites work with a few key strokes. To get
alternatiing colors in each row I set an expression for the background property like
so...&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#ff0000" face="Courier New"&gt;=If(RowNumber(Nothing) mod 2
= 0, "#80C0FF", "White")&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
Which is simple enough, and I can select all the text boxes in a report and set the
property for all of them, but if I have more than 2 reports and want to change the
alternating color or font, etc. for all of them -- it will get very dull, very fast.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;I'm thinking the way to do this is to set a code call for each textbox with
a parameter.&amp;nbsp; There is a facility to call functions for most (if not all) the
property settings.&amp;nbsp; So unless I can find a better "native" way, what I'll do
is write a method that returns the 
&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#ff0000" face="Courier New"&gt;static string GetBackgroundColorFromClassName(string
ClassName)&lt;/font&gt;
&lt;br&gt;
&lt;font color="#ff0000" face="Courier New"&gt;{&lt;/font&gt;
&lt;br&gt;
&lt;font color="#ff0000" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string BackgroundColor
="White"; //or some default color&lt;/font&gt;
&lt;br&gt;
&lt;font color="#ff0000" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(ClassList.ContainsKey(ClassName))&lt;/font&gt;
&lt;br&gt;
&lt;font color="#ff0000" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; BackgroundColor
= ClassList[ClassName];&lt;/font&gt;
&lt;br&gt;
&lt;br&gt;
&lt;font color="#ff0000" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return BackgroundColor;&lt;/font&gt;
&lt;br&gt;
&lt;font color="#ff0000" face="Courier New"&gt;}&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
The ClassList in this case would be a NameValue collection. Would build&amp;nbsp; it from
a config file. Or maybe even rip it from the&amp;nbsp; css file.&amp;nbsp; Hmmm. Something
to investigate.&lt;br&gt;
&lt;br&gt;
Then in the N TextBox Background color properties I'd change the code to something
like (i'm not sure of the exact syntax for referencing an external mehtod):&lt;br&gt;
&lt;br&gt;
&lt;blockquote&gt;&lt;font color="#ff0000" face="Courier New"&gt;=If(RowNumber(Nothing) mod 2
= 0, &lt;/font&gt;&lt;font color="#ff0000" face="Courier New"&gt;GetBackgroundColorFromClassName("AltItem")&lt;/font&gt;&lt;font color="#ff0000" face="Courier New"&gt;, &lt;/font&gt;&lt;font color="#ff0000" face="Courier New"&gt;GetBackgroundColorFromClassName(&lt;/font&gt;&lt;font color="#ff0000" face="Courier New"&gt;"Item"))&lt;/font&gt;
&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
Speaking of properties...&lt;br&gt;
&lt;br&gt;
There is some minor foo going on in the report designer.&amp;nbsp; Select a text box in
a report, right-click and select Properties, a tabbed properties dialog box appears.&amp;nbsp;
Hit&amp;nbsp; the &amp;lt;F4&amp;gt; key instead and the ubiquitous properties window appears.&amp;nbsp;
There is some overlap, but there are also differences in what properties are available
from each view and in how they are organized. At least the tabbed dialog can be accessed
from the properties window by clicking on the last button on the top the window (the
icon does resemble a tabbed dialog box with a bit of squinting).&lt;br&gt;
&lt;br&gt;
It is confusing the first couple of times searching for where to set something. I've
trained myself to hit &amp;lt;F4&amp;gt; because the properties window displays everything
that is available in one view.&amp;nbsp; Definitely beats hunting through the tabs. 
&lt;br&gt;
&lt;br&gt;
And Now To Hyperlinks...&lt;br&gt;
&lt;br&gt;
One of the glorious things about the web -- actually the foundation of its very usefulness
-- is the hyperlink.&amp;nbsp; The ability to dash off to something else of interest with
a simple click is so common, I think we take for granted how revolutionary the idea
was.&amp;nbsp; Using hyperlinks in straight html reports is done without thought.&amp;nbsp;
And fortunately, Reporting Services does in fact allow for their existence.&amp;nbsp;
The &lt;a href="http://msdn2.microsoft.com/en-us/library/ms252126.aspx"&gt;Action Property&lt;/a&gt; of
the TextBox is where the ability to add a hyperlink is hidden.&amp;nbsp; Selecting "Jump
To URL" and adding a URL does just what you'd want it to do.&amp;nbsp; You'll have to
add some custom code to use app paths, etc.&amp;nbsp; But for static URLs it is very straightforward.&lt;br&gt;
&lt;br&gt;
There is one trifling annoyance, though the hyperlink is created easily, it is not
styled as a hyperlink when the report renders.&amp;nbsp; I manually did so with the color
and text decoration properties.&amp;nbsp; I want my CSS.&amp;nbsp; Didn't realize how much
I would miss it, stepping away from it ever so slightly.&lt;br&gt;
&lt;br&gt;
Firefox's One Character Columns...&lt;br&gt;
&lt;br&gt;
While Reporting Services does render reports in Firefox without too much kicking and
screaming, it does &lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=83194&amp;amp;SiteID=1"&gt;collapse
all the columns to one character width&lt;/a&gt;.&amp;nbsp; Very efficient use of horizontal
space, but annoying for everything but &lt;a href="http://en.wikipedia.org/wiki/Sodoku"&gt;sodoku&lt;/a&gt; output.&amp;nbsp;
There is a workaround in the forum linked to above -- a hidden textbox with a fixed
width across the entire report keeps it from collapsing in Firefox.&lt;br&gt;
&lt;br&gt;
Finally, Data Sources and Temp Tables...&lt;br&gt;
&lt;br&gt;
I always work with stored procedures, and Reporting Services supports using them as
Data Sources.&amp;nbsp; Visual Studio even has a wizard for creating a table adapter to
wrap around a stored procedure. This works very well and makes it easy drag the output
columns into the report. However, if the stored procedure is selecting from a temp
table, then the table adpater won't work.&amp;nbsp; The error returned is that #SomeTempTable
is undefined.&amp;nbsp; Which is perfectly true.&amp;nbsp; It dies when the stored procedure
completes, but the output ifrom the procedure is still there!&amp;nbsp; Smells like bad
encapsualtion to me.&amp;nbsp; It shouldn't matter how the table is created, something
is peeking too deep.&amp;nbsp; The workaround, of course, is to create a real table that
matches the output for the purposes of the data adapter and designer.&amp;nbsp; At run
time, the data table created from the stored procedure is added dynamically as the
Data Source and the report does not give a hoot how it was created. 
&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.vpsw.com/blogbaby/aggbug.ashx?id=977e0b90-5e81-4f41-9147-140e03f3c0c9" /&gt;</description>
      <comments>http://www.vpsw.com/blogbaby/CommentView,guid,977e0b90-5e81-4f41-9147-140e03f3c0c9.aspx</comments>
      <category>Reporting Services</category>
    </item>
  </channel>
</rss>