{"id":108,"date":"2009-05-17T10:49:00","date_gmt":"2009-05-17T10:49:00","guid":{"rendered":"\/lisa\/post\/2009\/05\/17\/Whitespace-occasionally-can-jump.aspx"},"modified":"2009-05-17T10:49:00","modified_gmt":"2009-05-17T10:49:00","slug":"whitespace-occasionally-can-jump","status":"publish","type":"post","link":"https:\/\/spacefold.com\/lisa\/2009\/05\/17\/whitespace-occasionally-can-jump\/","title":{"rendered":"Whitespace occasionally can jump"},"content":{"rendered":"<p>\nPardon the bad pun in the title; it&#39;s from<a href=\"http:\/\/www.imdb.com\/title\/tt0105812\/\" target=\"_blank\" title=\"White Men Can't Jump at IMDB\" rel=\"noopener\"> yet another movie that I really love<\/a>.\n<\/p>\n<p class=\"NB\">\nHow could I fail to love a movie that&nbsp;includes the memorable line <br \/>\n&quot;You can put a cat in the oven, but that don&#39;t make it a biscuit&quot;?&nbsp;&nbsp;<br \/>\nI beg you to think&nbsp;of the software implications&nbsp;of that statement&#8230;\n<\/p>\n<p>\nAdditional irrelevant cinema information, before we get down to business:&nbsp; C &amp; I saw <a href=\"http:\/\/www.startrekmovie.com\/\" target=\"_blank\" title=\"Star Trek 2009 official site\" rel=\"noopener\">Star Trek<\/a> this weekend.&nbsp; When Tennessee Williams said &quot;If people behaved in the way nations do, they would all be put in straitjackets&quot;, he&nbsp;was&nbsp;exempting most plot-required behavior of movie villians, and of some of the heroes as well.&nbsp;&nbsp;\n<\/p>\n<p>\nNevertheless, if Spock can stick his logic-meter into the secret pocket of his wallet for a couple of hours, along with [oops! possible spoiler in this paragraph] what most other young men probably stash there, then we can too.\n<\/p>\n<p>\nThis was&nbsp;the most fun I&#39;ve had at a movie in a long time.&nbsp; Go thou, and soak yourself in the pleasure of meeting &quot;your&quot; fave characters once again.\n<\/p>\n<h2 class=\"NB\">Moving between report contexts<\/h2>\n<p>\nI&#39;m working with a client who&#39;s defining some reporting architecture with interesting constraints.&nbsp; One of the subjects that has come up is the best way to shift focus between different result sets within a report.&nbsp; For example, a one-to-many relationship in a form or a report has a &quot;classic&quot; display method in most environments; what&#39;s the best way to do it in Reporting Services?\n<\/p>\n<p>\nDepending on what you need, there are several answers to that question in-the-box.&nbsp; But if you are working in an ASP.NET context to start with, I think it is worth thinking about the &quot;Navigation&quot; or &quot;Action&quot; properties of report items, and how you can get creative with them.\n<\/p>\n<p>\nWhat we&#39;re talking about here&nbsp;pretty easy and will apply to both SQL 2005 and 2008 Reporting Services equally.&nbsp; One caveat:&nbsp;Report Builder 1.0 can&#39;t do some of these tricks, so for Ad-Hoc reports you&#39;re more limited in SQL RS 2005.\n<\/p>\n<h3>Standard subspace jumps<\/h3>\n<p>\nReporting Services offers you &quot;bookmarks&quot; within a report layout, so if you have a &quot;one&quot; and a &quot;many&quot; dataset in the same report you can bring the user back and forth between appropriate places in the layout without much trouble.&nbsp;\n<\/p>\n<p>\nYou just need to use expressions for the bookmarks that include the appropriate key values, plus some kind of prefix to help you understand what you are doing when you reference the bookmark from another report object, for example: <strong>=&quot;City_&quot; &amp; Fields!CityCode.Value<\/strong>.&nbsp;\n<\/p>\n<p>\nI find this method difficult to incorporate into a user-defined layout, however, especially if the&nbsp;report data hasn&#39;t been denormalized into a single, vast result set already.&nbsp;&nbsp;I also find the &quot;document map&quot; method of handling context navigation clumsy. &nbsp;But they&#39;re both&nbsp;worth mentioning, because they are properly part of the full navigational (or &quot;action&quot;, in 2008) set of features available to us, so you may&nbsp;see them when you&#39;re working on the other methods we&#39;ll discuss here. Also, the various in-the-box renderers do have some notion of how to use them if, like Excel, they have some native analog to HTML jump capability.\n<\/p>\n<p class=\"NB\">\nYou may see them&#8230; in 2005, not so obviously in 2008. FWIW setting the bookmark or documentmap properties of a report item is a little more difficult to find in the RS 2008&nbsp;Designer\/Builder, but&nbsp;they&nbsp;<em>are<\/em> there.&nbsp; Go to the Properties window&nbsp;with the&nbsp;report item in question selected (the line, textbox, whatever &#8212; not its row or data region) and look under &quot;Other&quot;.&nbsp; Guess I&#39;m not the only one who didn&#39;t use these very much.\n<\/p>\n<p>\nUsing subreports is actually the most convenient way to change your reporting context &#8212; assuming you have a reporting server available.&nbsp; In the example below, using my beloved MySQL World tutorial database, you can see a row linking a City subreport to a Country report by the country code.&nbsp; To filter the cities properly, I&#39;m passing the current Country code value to the subreport.\n<\/p>\n<p style=\"text-align: center\">\n<img loading=\"lazy\" decoding=\"async\" style=\"width: 390px; height: 312px\" src=\"\/lisa\/wp-non\/migrated\/2009\/5\/RDLJump1.png\" alt=\"\" width=\"390\" height=\"312\" \/>\n<\/p>\n<p>\nTypically, if the City report should also stand alone and report on all cities, you&#39;re going to set the CountryCode parameter in that report something like this:\n<\/p>\n<ol class=\"dummy\">\n<li class=\"dummy\">Hide this parameter, unless it is appropriate for your subreport to navigate to other &quot;parents&quot; &#8212; which it can be, and they can actually reference back &quot;up&quot; to that other parent if you wish.&nbsp;<\/li>\n<li class=\"dummy\">Allow a null value as the value of the parameter<\/li>\n<li class=\"dummy\">Set your&nbsp;query or web service up to do&nbsp;the equivalent of the following: \n<p class=\"code\">\n\t<br \/>\n\tSELECT&nbsp;&nbsp;&nbsp;&nbsp; *<br \/>\n\t&nbsp;&nbsp; &nbsp;FROM City<br \/>\n\tWHERE<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp; (@CountryCode IS NULL) OR<br \/>\n\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(CountryCode = @CountryCode)&nbsp;\n\t<\/p>\n<\/li>\n<li class=\"dummy\">\n<p>\n\tIf there are columns such as country name or code that will be redundant in the City report when it is functioning as a subreport, simply set its Hidden property in this way, so that you see them in standalone mode but they disappear when you don&#39;t need them:&nbsp;<strong>=Not IsNothing(Parameters!CountryCode.Value)<\/strong>.<strong>&nbsp;<\/strong>&nbsp;\n\t<\/p>\n<\/li>\n<\/ol>\n<p>\nThat&#39;s the whole deal. And, allthough a little hard to manage, in certain conditions, using nested data regions works well also.&nbsp;\n<\/p>\n<p>\nBut the &quot;navigation&quot; or &quot;action&quot; features let you design the jump yourselves. And I think sometimes they meet people&#39;s expectations just a bit better.\n<\/p>\n<h3>Warp-factored jumps<\/h3>\n<p>\nTry using a Jump to a report instead.&nbsp;(&quot;Navigate to a report&quot;, in 2005, &quot;Action, go to report&quot; in 2008).&nbsp; The first thing you&#39;ll notice is that you can use an expression, and of course that includes custom code.&nbsp; The screenshot below incorporates a simple of example of why you might want to &#8212; here, I&#39;m using 2005:\n<\/p>\n<p align=\"center\">\n<img loading=\"lazy\" decoding=\"async\" style=\"width: 540px; height: 344px\" src=\"\/lisa\/wp-non\/migrated\/2009\/5\/RDLJump2.png\" alt=\"\" width=\"540\" height=\"344\" \/>\n<\/p>\n<p>\nAs you can also see in the screenshot, you have the same opportunity to pass along parameters.&nbsp; Here, you see the &quot;Omit&quot; option; do you want this value to be passed to the value in the parameter with an equivalent name in the report, or not?&nbsp; Most of the time, the default value of False is probably what you&#39;ll want.\n<\/p>\n<h3>Hyperspace jumps<\/h3>\n<p>\nBut wait, there&#39;s more.&nbsp;&nbsp;We can also jump to a URL, rather than a report, and of course you can still use an expression to&nbsp;generate the proper URL &#8212; so you can still feed parameters directly to a report on the report server, if you would like to (using <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms155362\/\" target=\"_blank\" title=\"MSDN on URL Access in RS 2008\" rel=\"noopener\">URL Access<\/a>).\n<\/p>\n<p>\nBut you can also jump to another page in your app, perhaps with a reportviewer control on it, or a page that lets the user drill down to edit the contents of that line in your report.\n<\/p>\n<p>\nOr you can jump to something else entirely.&nbsp; You can even jump to a page that manages the current report, if the current user has privileges to do so, and use expressions for both the jump and visibility to hide the feature from the user if s\/he doesn&#39;t.&nbsp; For example, a link that says &quot;click here to go to the Subscriptions page for this report&quot; might have the following expression underneath:\n<\/p>\n<p class=\"code\">\n=&quot;<a href=\"http:\/\/localhost\/Reports\/Pages\/Report.aspx?ItemPath\">http:\/\/localhost\/Reports\/Pages\/Report.aspx?ItemPath<\/a>=&quot; &amp; <br \/>\n&nbsp;&nbsp; Globals!ReportFolder &amp; &quot;\/&quot; &amp; <br \/>\n&nbsp;&nbsp; Globals!ReportName &amp; <br \/>\n&nbsp;&nbsp; &quot;&amp;SelectedTabId=SubscriptionsTab&quot;\n<\/p>\n<p>\n&#8230; life can get pretty interesting, and I&#39;m not using the <a href=\"http:\/\/www.serenitymovie.com\/\" target=\"_blank\" title=\"This is the captain, we may experience some turbulence and then explode.\" rel=\"noopener\">Serenity definition of &quot;interesting&quot;<\/a> here.\n<\/p>\n<p>\nOh, one more thing.&nbsp; With all these interesting capabilities, you may want to have the link open a new window (which you&#39;ll define with appropriate window attributes).&nbsp; I&#39;m not sure how this part will translate to your various renderered versions of the output, but for the HTML displayed version, you do it like this:\n<\/p>\n<p class=\"code\">\n<br \/>\n=&quot;javascript:void window.open (<br \/>\n&nbsp;&nbsp; &#39;https:\/\/spacefold.com\/lisa&#39;,<br \/>\n&nbsp;&nbsp; &#39;mywindow&#39;,<br \/>\n&nbsp;&nbsp; &#39;status=1,height=200,width=200&#39;);&quot;\n<\/p>\n<p>\nThe &quot;mywindow&quot; argument there names the window you intend to use, which gives you more control over adding more code to re-use and position the new window, of course.&nbsp;&nbsp;\n<\/p>\n<h3>Whitespace jumps?<\/h3>\n<p>\n<strong>Any<\/strong> report item &#8212; a line, a completely&nbsp;empty text box &#8212; can handle navigation for you.&nbsp; You could conceivably underlay your report data with a white rectangle in the layout so that clicking&nbsp;anywhere on&nbsp;the &quot;empty surface&quot; of the page caused some behavior, not that I&#39;ve tried this.&nbsp;\n<\/p>\n<p>\nAt least in 2005, you&#39;re limited to putting an &quot;action&quot; on the entire report item, you can&#39;t create clickable areas within one report pseudo-object.\n<\/p>\n<p>\nRS 2008 offers you the interesting possibility of HTML placeholders, with which I haven&#39;t played much, but it appears that you can indeed surmount this limitation there (whether they&#39;ll translate properly into the Excel rendition, I suppose, is another story). You could potentially set up custom code to do all kinds of stuff in there.\n<\/p>\n<p align=\"center\">\n<img loading=\"lazy\" decoding=\"async\" style=\"width: 399px; height: 332px\" src=\"\/lisa\/wp-non\/migrated\/2009\/5\/RDLJump3.png\" alt=\"\" width=\"399\" height=\"332\" \/>&nbsp;\n<\/p>\n<p>\nIn the example above, I&#39;ve succeeded in using the javascript method of opening a new window from within the 2008 placeholder code.&nbsp;\n<\/p>\n<p>\nThat&#39;s not required, of course, but it was of interest to me to find out if the expression could work this way, when required.&nbsp;&nbsp;Here&#39;s the expression I used; note the encoded quotation marks, which exist in the original code (they&#39;re not an error in this post):\n<\/p>\n<p class=\"code\">\n<br \/>\n=&quot;this is a &lt;a&nbsp; href=&#39;javascript:void window.open <br \/>\n(&amp;quot;https:\/\/spacefold.com\/lisa&amp;quot;,<br \/>\n&nbsp;&amp;quot;mywindow&amp;quot;,<br \/>\n&nbsp;&amp;quot;status=1,height=200px,width=200px;&amp;quot;);&#39;&gt;<br \/>\n&nbsp;test&lt;\/a&gt; <br \/>\n&nbsp;of a placeholder.&quot;\n<\/p>\n<p>\nBTW: the linking behavior may not appear to work in Report Preview, you may have to deploy it to a report server&nbsp;before you can see it.&nbsp;\n<\/p>\n<p>\nNote that I haven&#39;t succeeded (yet) in getting a title or alt attribute to work within the placeholder, perhaps because its external tooltip element is interfering &#8212; so what you see in the screenshot&nbsp;as a tooltip is the external property for placeholders at work.&nbsp;\n<\/p>\n<p>\nI haven&#39;t even gotten the HTML tag-handling behavior of placeholders&nbsp;to work in debug mode (the separate viewer outside Studio) but of course I might be doing something wrong.\n<\/p>\n<h2>Where no-one can go before you<\/h2>\n<p>\nIf subreports are so convenient, what&#39;s the problem? Why go through all this? Why bother?\n<\/p>\n<p>\nWell&#8230; subreports kinda don&#39;t work in local-mode for ReportViewer, unless you want to grab events, and they definitely don&#39;t work with Ad-hoc reports that have access to report data, but not access to a report server.\n<\/p>\n<p>\nAnd now you know how I got to thinking about&nbsp;using jumps, instead,&nbsp;in the first place.&nbsp;\n<\/p>\n<p>\nSet your imagination free, in some parallel universe, where Romulans wear the coolest clothes (but didn&#39;t they always?). Think about what they can do for you.\n<\/p>\n<p>\nMr. Sulu, maneuvering thrusters, please.&nbsp; Steady as she goes&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pardon the bad pun in the title; it&#39;s from yet another movie that I really love. How could I fail to love a movie that&nbsp;includes the memorable line &quot;You can put a cat in the oven, but that don&#39;t make it a biscuit&quot;?&nbsp;&nbsp; I beg you to think&nbsp;of the software implications&nbsp;of that statement&#8230; Additional irrelevant<a class=\"more-link\" href=\"https:\/\/spacefold.com\/lisa\/2009\/05\/17\/whitespace-occasionally-can-jump\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,4,5,6],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-asp-net","category-life","category-reporting","category-sql-server"],"_links":{"self":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":0,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"wp:attachment":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}