{"id":180,"date":"2007-09-09T10:13:00","date_gmt":"2007-09-09T10:13:00","guid":{"rendered":"\/lisa\/post\/2007\/09\/09\/Code-Tense-Imperfect.aspx"},"modified":"2021-08-30T13:49:17","modified_gmt":"2021-08-30T20:49:17","slug":"code-tense-imperfect","status":"publish","type":"post","link":"https:\/\/spacefold.com\/lisa\/2007\/09\/09\/code-tense-imperfect\/","title":{"rendered":"Code Tense: Imperfect"},"content":{"rendered":"<p>C and I were away for a bit,\u00a0and since then we have been bearing down on some fierce deadlines.<\/p>\n<p>Several massive reporting code bases for which\u00a0the two of us\u00a0are responsible are having their back-end pulled out from under them &#8212; again.\u00a0 This is the third time in four years that one set of (cough!) <a title=\"C's take\" href=\"\/colin\/posts\/2007\/09-06Enterprise-ready.html\">enterprise applications<\/a> have been chucked out, rejected by users because they don&#8217;t fit their business processes, and replaced by others &#8212; to the tune of we-don&#8217;t-know-how-many millions of dollars.<\/p>\n<p>Meanwhile our small, light\u00a0ASP.Net\u00a0front ends\u00a0keep on pulling data out and making sense of the whole thing, transparently changing to fit the data underneath, and with enviable (especially if you&#8217;re an enterprise application) up-time records.<\/p>\n<p>This week, while working on this latest makeover,\u00a0I made what is probably a beginner&#8217;s mistake in a join. I watched, horrified, as my new queries slowed to a crawl.\u00a0 In the interests of completely humiliating myself and at the same time maybe saving somebody else some hair-tearing-out, I&#8217;m going to tell you exactly what I did wrong:<\/p>\n<ul>\n<li>the join is on two fields of varchar type: an order key and a line item key.<\/li>\n<li>the fields are referenced in a SQL Server clustered index. So everything should be fine.\u00a0 Right?<\/li>\n<li>except I wrote:\n<div class=\"code\">SSD.OrderKey +\u00a0SSD.LineKey =\u00a0\u00a0SD.OrderKey + SD.LineKey\n<\/div>\n<\/li>\n<li>instead of\n<div class=\"code\">SSD.OrderKey = SD.OrderKey AND SSD.LineKey = SD.LineKey\n<\/div>\n<\/li>\n<li>There is actually a sub-line-item key as well, which may be null (also referenced in the index).\u00a0 Things are going to get much, much worse (gotta work in a <a title=\"browncoat alert!\" href=\"http:\/\/www.serenitymovie.com\/\">Serenity <\/a>quote whenever possible) if you do this:\n<div class=\"code\">SSD.OrderKey + SSD.LineKey + ISNULL(SSD.SubLineKey,SPACE(0)) \u00a0=<br \/>\nSD.OrderKey + SD.LineKey + ISNULL(SD.SubLineKey,SPACE(0))\n<\/div>\n<\/li>\n<\/ul>\n<h5>Well thank goodness that&#8217;s over.<\/h5>\n<p>To apologize for my absence here, and because I already know my code will never be perfect, I&#8217;ve decided not to delay any longer in uploading the first cut of <a title=\"blog post introducing XMLRSDocs and RDLDocumenter\" href=\"\/lisa\/2007\/08\/03\/Introducing-XMLRSDocs-and-RDLDocumenter\/\">my RDLDocumenter Reporting Services documentation utility<\/a>.<\/p>\n<p>You can read <a title=\"XMLRSDocs docs-article\" href=\"\/articles\/xmlrsdocs\/\">its docs on line<\/a> in our articles section (they now contain a link to the new zip) or just get the\u00a0zip from our downloads page.\u00a0 If you choose just to download, the zip has up-to-date docs as of this posting. You will need them\u00a0if you want to\u00a0get a full picture of what XMLRSDocs is for, and even if you don&#8217;t you will need to read them to properly deploy the Report Designer add-on component in your Visual Studio environment and also, if desired, add the rendering component to your Reporting Services environment.<\/p>\n<p>This is a deployment set of files, completely usable with some extra sample scripts, a test harness form, an SSIS production-style\u00a0package,\u00a0and even a local CE database implementation if you want to use it as a back end (not required).\u00a0 It&#8217;s not full source. Perfect or not, I want to delay releasing source for now.\u00a0 For one thing, there are two versions of the source: the VB source, which is up to date with the version you&#8217;ll see in the deployment files, and a C# version I froze some time back, before I realized some facts of life (we generally call them &#8220;infelicities&#8221;) in Report Designer integration opportunities.<\/p>\n<p>They aren&#8217;t deficiencies in the RDL schema, only in the Designer and its underlying classes, so I am still hoping that Katmai will allow me to lift some of the limitations that I faced in building this thing.\u00a0 Whether\u00a0Katmai changes the\u00a0ground rules significantly or not, I will be discussing this topic (Report Designer Extensibility and some crazy stuff you can do with it) further here, I hope.\u00a0 And no matter what happens in Katmai, the results you can get from this version of RDLDocumenter should continue to be valid, we&#8217;ll just have a more elegant implementation underneath.<\/p>\n<h5>Code doesn&#8217;t have to be perfect to be durned helpful.<\/h5>\n<p>As I have mentioned in previous posts, RDLDocumenter caused me to face down a whole gamut of dynamic reporting scenarios, practically comprising a set of FAQs for questions that show up in the Reporting Services forums.\u00a0 I expect to be posting illustrative samples from the RDLDocumenter code base here, long before I post full source.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C and I were away for a bit,\u00a0and since then we have been bearing down on some fierce deadlines. Several massive reporting code bases for which\u00a0the two of us\u00a0are responsible are having their back-end pulled out from under them &#8212; again.\u00a0 This is the third time in four years that one set of (cough!) enterprise<a class=\"more-link\" href=\"https:\/\/spacefold.com\/lisa\/2007\/09\/09\/code-tense-imperfect\/\">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":[5,6,7],"tags":[],"class_list":["post-180","post","type-post","status-publish","format-standard","hentry","category-reporting","category-sql-server","category-ssis"],"_links":{"self":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/180","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=180"}],"version-history":[{"count":2,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/180\/revisions"}],"predecessor-version":[{"id":400,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/180\/revisions\/400"}],"wp:attachment":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/media?parent=180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/categories?post=180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/tags?post=180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}