{"id":125,"date":"2008-08-30T14:14:00","date_gmt":"2008-08-30T14:14:00","guid":{"rendered":"\/lisa\/post\/2008\/08\/30\/A-bug-IMHO-and-a-workaround-for-conditional-column-export-scenarios.aspx"},"modified":"2008-08-30T14:14:00","modified_gmt":"2008-08-30T14:14:00","slug":"a-bug-imho-and-a-workaround-for-conditional-column-export-scenarios","status":"publish","type":"post","link":"https:\/\/spacefold.com\/lisa\/2008\/08\/30\/a-bug-imho-and-a-workaround-for-conditional-column-export-scenarios\/","title":{"rendered":"A bug, IMHO, and a workaround, for conditional column export scenarios"},"content":{"rendered":"<p align=\"left\">\n<a href=\"mailto:Steve.Gavin@ihs.com\" target=\"_blank\" rel=\"noopener\">Steve&nbsp;Gavin<\/a> wrote with an interesting question that, at first, I got backwards.\n<\/p>\n<p>\nHe has a requirement for CSV export output from&nbsp;a report that conditionally hides columns, and he couldn&#39;t get the output the way he wanted it to be.&nbsp; I immediately thought,&nbsp;&quot;That makes sense, somehow the CSV renderer [and as it turns out, the XML&nbsp;renderer] don&#39;t know anything about &quot;visibility&quot; logic, just as they couldn&#39;t overlay two items, so all the column data is always showing up.&quot;\n<\/p>\n<p>\nWell, no.&nbsp; The &quot;backwards&quot; part is that <em>none<\/em> of the conditionally hidden data is showing up.&nbsp; After testing, here is my assessment:\n<\/p>\n<blockquote>\n<p style=\"font-size: larger; color: red; background-color: whitesmoke\">\n\tIf a column has its Hidden property set to any expression, even&nbsp;as innocent an expression as <strong>=False<\/strong> (I kid you not, that explicit expression meaning &quot;don&#39;t hide&quot;&nbsp;will still do it),&nbsp;that column and its values&nbsp;will not display in CSV or XML output.\n\t<\/p>\n<\/blockquote>\n<p>\nI guess somebody at Microsoft will say this is a security feature. If it&#39;s possible at all that something should be hidden, then never-ever-ever display it in a data export, no matter what?\n<\/p>\n<p>\nCome on.\n<\/p>\n<h4 class=\"NB\">So what&#39;s the workaround?<\/h4>\n<p>\nUsually I remind you that you&#39;re not stuck with the output Reporting Services hands you, that the XML data export plus XSLT provides a wonderful way to format the report data any way you want.&nbsp; In this case, the XML output has some significant infelicities so we need to do a little more work, but not much.\n<\/p>\n<p>\nCreate a second report exactly like the first, with no Hidden expressions.&nbsp; It&#39;s easy to parse the RDL to remove them, whether you do it with the DOM or XSLT.&nbsp; In XSLT, you&nbsp;might take any identity transform&nbsp;and make a simple change to strip Visibility elements, like this:\n<\/p>\n<p>\n<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c194KG\"><font color=\"#602020\">?xml version=&quot;1.0&quot;?<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<span class=\"c9Y6TC\">&lt;<\/span><\/font><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:stylesheet <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">version=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1.0&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> xmlns:xsl=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;http:\/\/www.w3.org\/1999\/XSL\/Transform&quot;<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font><span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:output <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">encoding=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;utf-8&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<span class=\"c9Y6TC\">&lt;<\/span><span class=\"c69ORU\"><font color=\"#aaaba0\">!&#8211; strip Visibility elements from an RDL &#8212;<\/font><\/span><span class=\"c9Y6TC\">&gt;<\/span><font color=\"#000000\">&nbsp;<br \/>\n<\/font><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:template <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">match=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;*&quot;<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:copy<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:apply-templates <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;@*&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:value-of <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;text()&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:apply-templates <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;.\/*[local-name() != &#39;Visibility&#39;]&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">\/xsl:copy<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">\/xsl:template<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><\/p>\n<p><\/font>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:template <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">match=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;@*&quot;<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:attribute <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;{name()}&quot;<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:value-of <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;.&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">\/xsl:attribute<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">\/xsl:template<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<span class=\"c9Y6TC\"><br \/>\n&lt;<\/span><\/font><span class=\"c49DIK\"><font color=\"#ac306d\">\/xsl:stylesheet<\/font><\/span><span class=\"c9Y6TC\"><font color=\"#0000ff\">&gt;<\/font><\/span>\n<\/p>\n<p>\n&#8230; so now, at runtime, you can request the XML from this second report rather than the &quot;real&quot; report.&nbsp; Give the XSLT the parameters that you usually give Reporting Services and let the XSLT decide what columns should be rendered to CSV, or a &quot;stripped&quot; version of the XML if you need that, on this run.\n<\/p>\n<p>\n&quot;Oh, that&#39;s going to be hard!&quot;, you say?&nbsp; No it isn&#39;t.&nbsp;&nbsp;\n<\/p>\n<p>\nFirst, I&#39;m going to give you a full example here.&nbsp; I&#39;ll use Steve&#39;s method of parameterizing his report to hide and show columns in my XSLT example, but the thing is trivial enough for you to figure out how your own parameter strategy could be used in something similar.&nbsp;\n<\/p>\n<p>\nSecond, although you won&#39;t be <a href=\"\/lisa\/2007\/10\/03\/Changing-the-Sheet-names-in-SQL-Server-RS-Excel-QnD-XSLT\/\" target=\"_blank\" title=\"Post on attaching XSLT to a report definition for Excel\" rel=\"noopener\">automagically<\/a> applying the XSLT by attaching it to the RDL, you are really better off learning to request the XML and apply the XSLT yourself.&nbsp; This gives you a chance to apply different&nbsp;XSLT files, at will,&nbsp;for different formatting requirements, and also to apply parameters for dynamic behavior, as we&#39;re going to do here.&nbsp; I won&#39;t belabor this point, because I&#39;ve discussed it elsewhere, so please read <a href=\"\/lisa\/2007\/10\/28\/After-you-learn-to-walk-you-can-run-a-postscript-to-the-QnD-XSLT-walkthrough\/\">https:\/\/spacefold.com\/lisa\/2007\/10\/28\/After-you-learn-to-walk-you-can-run-a-postscript-to-the-QnD-XSLT-walkthrough<\/a>and let&#39;s move on.\n<\/p>\n<h5>Important&nbsp;caveat&nbsp;<\/h5>\n<p>\nI should say that this is all possible assuming you, like Steve, have some programmatic way of accessing ReportServer, such as I&#39;ve already shown in other posts (<a href=\"\/lisa\/2007\/09\/20\/Another-bit-for-dynamic-ReportViewer-control-handling-Parameters-in-more-depth\/\" target=\"_blank\" title=\"Post showing url access to ReportServer\" rel=\"noopener\">url access<\/a> and <a href=\"\/lisa\/2008\/03\/03\/Report-Preprocessing-SQL-Server-Reporting-Server-Group-PageTotals-Part-II-A-Walkthrough-on-the-Client-Side\/\" target=\"_blank\" title=\"Post showing web service access to ReportServer\" rel=\"noopener\">web service<\/a> styles).&nbsp; You need this,&nbsp;because we&#39;re intervening before the user gets the report results.&nbsp;We&#39;re swapping to a different report for the request, we&#39;re asking for XML, we&#39;re loading the parameters into the XSLT, applying the XSLT to the XML, and providing the result to the user.&nbsp;\n<\/p>\n<p>\n&nbsp;If you currently rely on Report Manager for your end-user interface, you need to add a custom interface at least for this&nbsp;particular part.\n<\/p>\n<p>\nOnce you&#39;ve made this leap, there is so much more possible!\n<\/p>\n<h4>Workaround implementation<\/h4>\n<p>\nSteve&#39;s report offers sufficient complexity and yet a sufficiently general scenario to be a worthwhile example.&nbsp; Basically, his report contains some fixed columns, which always appear, and some other columns grouped into <em>attribute sets<\/em>.&nbsp; I think there is a parameter associated with each attribute set, with a string of T&#39;s and F&#39;s representing the user&#39;s choices (or perhaps security settings) for column visibility within that set.&nbsp;\n<\/p>\n<p>\nI could be wrong; Steve could have only one parameter and the attribute sets are only choose-able by group, not by individual column. In&nbsp;that case the whole problem is a bit simpler, but very similar.&nbsp;\n<\/p>\n<p>\nI chose to solve the more complex version, because I have no idea what <em>your<\/em> visibility strategy is, and I want you to see that you can stretch this method to do&#8230; whatever.&nbsp; OK?\n<\/p>\n<h5>Scenario<\/h5>\n<p>\nSo, let&#39;s assume that Steve has a report layout that looks something like this (last two columns are Requested_Ship and Requested_Install, respectively):\n<\/p>\n<p align=\"center\">\n<img loading=\"lazy\" decoding=\"async\" style=\"width: 546px; height: 80px\" src=\"\/lisa\/wp-non\/migrated\/ConditionalExports1.png\" alt=\"\" width=\"546\" height=\"80\" \/>\n<\/p>\n<p>\n&#8230; and let&#39;s assume that he has one parameter for Group1 and another for Group2.&nbsp;\n<\/p>\n<p>\nIf these two parameters have the values <strong>&quot;FT&quot;<\/strong> and <strong>&quot;TF&quot;<\/strong>, respectively, for a given report run, you might see a display result that looks like this:\n<\/p>\n<p align=\"center\">\n&nbsp;<img loading=\"lazy\" decoding=\"async\" style=\"width: 523px; height: 174px\" src=\"\/lisa\/wp-non\/migrated\/ConditionalExports2.png\" alt=\"\" width=\"523\" height=\"174\" \/>\n<\/p>\n<p>\n&#8230; meanwhile, the XML or CSV result from this run would only have the fixed columns, like this:\n<\/p>\n<p>\n<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c194KG\"><font color=\"#602020\">?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<span class=\"c9Y6TC\">&lt;<\/span><\/font><span class=\"cLUY2\"><font color=\"#ea8f0f\">Report <br \/>\n&nbsp; <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">p1:schemaLocation=<br \/>\n&nbsp; <\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;ConditionalExports http:\/\/reportserver?\/ConditionalExports&amp;amp;rs:Format=XML&amp;amp;rc:Schema=True&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> <br \/>\n&nbsp;&nbsp; Name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;ConditionalExports&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> <br \/>\n&nbsp;&nbsp; xmlns:p1=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> xmlns=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;ConditionalExports&quot;<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">table1<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">Detail_Collection<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">Detail <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">Sales_No=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1-67901846&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> Order_Quantity=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;8&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> Terms=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;NET 30&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">Detail <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">Sales_No=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1-65162786&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> Order_Quantity=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;32&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> Terms=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Special&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">Detail <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">Sales_No=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1-67980171&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> Order_Quantity=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;2&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> Terms=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Trial 45 Days&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<br \/>\n<\/span><\/font><font color=\"#0000ff\"><span class=\"c9Y6TC\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!&#8211; &#8230; &#8211;&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">\/Detail_Collection<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">\/table1<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<span class=\"c9Y6TC\">&lt;<\/span><\/font><span class=\"cLUY2\"><font color=\"#ea8f0f\">\/Report<\/font><\/span><span class=\"c9Y6TC\"><font color=\"#0000ff\">&gt;<\/font><\/span>\n<\/p>\n<p>\n&#8230; so now we create our second report, which looks like this,&nbsp;because all columns have lost their Hidden expressions. I&#39;m showing both design and run time here, and I&#39;ve changed the column color coding just to remind you. The screenshots are a bit truncated on the right side, so you can&#39;t see it, but all columns including Requested_Install on the right are present and accounted for, as fixed columns, here:&nbsp;\n<\/p>\n<p align=\"center\">\n<img loading=\"lazy\" decoding=\"async\" style=\"width: 455px; height: 282px\" src=\"\/lisa\/wp-non\/migrated\/ConditionalExports3.png\" alt=\"\" width=\"455\" height=\"282\" \/>\n<\/p>\n<p align=\"left\">\n&#8230; and we plan to get our source XML for exporting purposes from this version of the report.&nbsp; OK?\n<\/p>\n<h5 align=\"left\">Conditional columns using XSLT&nbsp;<\/h5>\n<p align=\"left\">\nLet&#39;s start creating an XSLT that will provide&nbsp;separated-value output with column-hiding to match the report&#39;s original intent.\n<\/p>\n<p align=\"left\">\nYou&nbsp;will see below that I&#39;m using a prefix of &quot;sp&quot; in this XSLT file, for a custom&nbsp;element that doesn&#39;t belong to XSLT for my own data. To do this (and this part of the implementation is optional, as I explain below), I add a suitable definition of this prefix to the root stylesheet element.&nbsp; (The location <a href=\"\/xslt\">http:\/\/spacefold.com\/xslt<\/a> doesn&#39;t really exist, and doesn&#39;t need to exist.)&nbsp; At the top level, I also provide an output method instruction, so that my separated value file is output as text rather than xml or html:\n<\/p>\n<p align=\"left\">\n<span class=\"c9Y6TC\"><font color=\"#0000ff\">&nbsp;&nbsp; &lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:stylesheet <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">version=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1.0&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> xmlns:xsl=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;http:\/\/www.w3.org\/1999\/XSL\/Transform&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> xmlns:sp=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;http:\/\/spacefold.com\/xslt&quot;<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:output <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">omit-xml-declaration=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;yes&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> method=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;text&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><span class=\"c9Y6TC\"><font color=\"#0000ff\">&gt;<\/font><\/span>\n<\/p>\n<p align=\"left\">\nLet&#39;s say Steve&#39;s report parameters are called Group1 and Group2.&nbsp; Our XSLT will have matching parameters:\n<\/p>\n<p align=\"left\">\n<span class=\"c9Y6TC\"><font color=\"#0000ff\">&nbsp;&nbsp; &lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:param <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Group1&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;&#39;FT&#39;&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:param <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Group2&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;&#39;TF&#39;&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c69ORU\"><font color=\"#aaaba0\">!&#8211; more here, as many groups as you have &#8212;<\/font><\/span><span class=\"c9Y6TC\"><font color=\"#0000ff\">&gt;<\/font><\/span>\n<\/p>\n<p align=\"left\">\nI&#39;m showing default values here that match my example report run in the screen shot, but obviously each group would have as many characters in the value as there are columns in the group&#39;s set of columns, and obviously at runtime you pass the parameter values to the report, with different combinations for each run.\n<\/p>\n<p class=\"NB\">\nIf you look carefully, you&#39;ll see single quotation marks (apostrophes) inside the select attribute&#39;s value (<span style=\"font-size: larger\">&quot;<span style=\"color: red\">&#39;<\/span>FT<span style=\"color: red\">&#39;<\/span>&quot;<\/span>). This is only necessary for the literal value, so that the xslt processor knows the value is a string; when you pass your string argument into the stylesheet object you don&#39;t have to add those extra marks.\n<\/p>\n<p align=\"left\">\nFor good measure let&#39;s add some more parameters to let the user customize the report value separators and delimiters, starting with a default of comma for the separator and nothing for the delimiters:\n<\/p>\n<p align=\"left\">\n<span class=\"c9Y6TC\"><font color=\"#0000ff\">&nbsp;&nbsp; &lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:param <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Separator&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;&#39;,&#39;&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:param <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Delimiter&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><span class=\"c9Y6TC\"><font color=\"#0000ff\">&gt;<\/font><\/span>\n<\/p>\n<p align=\"left\">\nNow let&#39;s set up a variable to represent <em>all<\/em>&nbsp;the columns in the report, concatenating all the group parameters togethers and adding the &quot;fixed&quot; columns into the full sequence, wherever they happen to appear in the layout.&nbsp;You can give the &quot;fixed&quot; columns the literal value &quot;T&quot; in this concatenated version, since they always appear&nbsp;in the report. In my example, there&#39;s one fixed column at the left of the table, and two more in between the two groups:\n<\/p>\n<p align=\"left\">\n<span class=\"c9Y6TC\"><font color=\"#0000ff\">&nbsp; &lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:variable <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Groups&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;concat(&#39;T&#39;,$Group1,&#39;TT&#39;,$Group2)&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c69ORU\"><font color=\"#aaaba0\">!&#8211; add &#39;T&#39; in proper position for all columns that aren&#39;t parameterized &#8212;<\/font><\/span><span class=\"c9Y6TC\"><font color=\"#0000ff\">&gt;<\/font><\/span>\n<\/p>\n<p align=\"left\">\n&#8230; and&nbsp;now let&#39;s tell the XSLT about the full set of columns.&nbsp; Here, I&#39;m doing it as a variable which I will refer to later on as a lookup set.&nbsp; This is the part of the stylesheet that uses my custom namespace (aliased as &quot;sp&quot;):\n<\/p>\n<p align=\"left\">\n<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">sp:GroupCols<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c69ORU\"><font color=\"#aaaba0\">!&#8211; the group and sequence information aren&#39;t really important,<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it&#39;s just for clarity in the example, with &quot;Group 0&quot; being fixed columns.<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The only important thing is that the full set of columns are represented<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in the same order as the concat&#39;d groups above so that the full sequence<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of T&#39;s and F&#39;s matches the column sequence here&nbsp;&#8212;<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cKJK\"><font color=\"#006800\">col <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">group=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;0&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> sequence=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Sales_No&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cKJK\"><font color=\"#006800\">col <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">group=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> sequence=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Revenue_Type&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cKJK\"><font color=\"#006800\">col <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">group=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> sequence=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;2&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Order_Type&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cKJK\"><font color=\"#006800\">col <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">group=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;0&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> sequence=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;2&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Order_Quantity&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cKJK\"><font color=\"#006800\">col <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">group=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;0&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> sequence=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;3&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Terms&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cKJK\"><font color=\"#006800\">col <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">group=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;2&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> sequence=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;1&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Requested_Ship&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cKJK\"><font color=\"#006800\">col <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">group=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;2&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> sequence=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;2&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\"> name=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;Requested_Install&quot;<\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">\/<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><br \/>\n<\/font>&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"cLUY2\"><font color=\"#ea8f0f\">\/sp:GroupCols<\/font><\/span><font color=\"#0000ff\"><span class=\"c9Y6TC\">&gt;<\/span><\/p>\n<p><span class=\"c9Y6TC\">&lt;<\/span><\/font><span class=\"c69ORU\"><font color=\"#aaaba0\">!&#8211; *******************************************<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end of non-generic code here<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;******************************************* &#8212;<\/font><\/span><span class=\"c9Y6TC\"><font color=\"#0000ff\">&gt;<\/font><\/span>\n<\/p>\n<p align=\"left\">\nThere are many other ways to&nbsp;reference custom data, especially if you want to use the same strategy for many different reports. In this scenario, in production use, you would probably&nbsp;pass the set of columns into the transform as another, XSLT-specific argument. You can even pass the RDL as a parameter, and let the XSLT look up the column information!&nbsp; You can also pass the location of an external lookup XML document holding the information about the columns, in whatever simplified format you like, something like what you see in the variable.&nbsp; For this tutorial, I&#39;m putting this information directly into the transform; it will help you&nbsp; see what I&#39;m doing more clearly.&nbsp;\n<\/p>\n<p align=\"left\">\nSo that&#39;s the end of the information that is report-specific in this XSLT file.&nbsp; Now come the templates that actually do the work. There&#39;s only about 30 lines of code, as you&#39;ll see in the complete file (<a href=\"\/lisa\/wp-non\/migrated\/ConditionalColumnsExport.xslt\">ConditionalColumnsExport.xslt (3.84 kb)<\/a>), and those 30 lines&nbsp;look more scary than they need to because I decided to parameterize the separator and delimiter.\n<\/p>\n<p align=\"left\">\nThere are two loops, one for the header line, and one for each detail row, that handle all the possible columns in the report and toss out any that are not marked with a &quot;T&quot; in the Groups variable, like this:\n<\/p>\n<p align=\"left\">\n&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"c9Y6TC\"><font color=\"#0000ff\">&lt;<\/font><\/span><span class=\"c49DIK\"><font color=\"#ac306d\">xsl:for-each <\/font><\/span><span class=\"c18YC0\"><font color=\"#d00020\">select=<\/font><\/span><span class=\"c5M9S0\"><font color=\"#000090\">&quot;document(&#39;&#39;)\/xsl:stylesheet\/sp:GroupCols\/col[substring($Groups,position(),1) = &#39;T&#39;]&quot;<\/font><\/span><span class=\"c9Y6TC\"><font color=\"#0000ff\">&gt;<\/font><\/span>\n<\/p>\n<p align=\"left\">\n&#8230; the expression will look a little different depending on how you provide information about the full column set to the XSLT, but not very different.&nbsp; The code inside each loop to provide the actual header line and rows is trivial.\n<\/p>\n<p align=\"left\">\nWith the parameters set as shown in the default strings, you&#39;ll get a result like this:\n<\/p>\n<p class=\"code\" align=\"left\">\nSales_No,Order_Type,Order_Quantity,Terms,Requested_Ship<br \/>\n1-67901846,New,8,NET 30,2007-05-25T00:00:00<br \/>\n1-65162786,New,32,Special,2007-05-25T00:00:00<br \/>\n1-67980171,New,2,Trial 45 Days,2007-05-26T00:00:00<br \/>\n1-67992057,New,3,Trial 45 Days,2007-05-26T00:00:00<br \/>\n1-66282631,Used,10,Rental with Purchase Option,2007-05-21T00:00:00\n<\/p>\n<h4 align=\"left\">&nbsp;&nbsp;<\/h4>\n<h4 align=\"left\">So that&#39;s it.<\/h4>\n<p align=\"left\">\nThat&#39;s the bug, and there&#39;s the workaround.\n<\/p>\n<h5 align=\"left\">Notice anything?<\/h5>\n<p align=\"left\">\nIf you&nbsp;look at the last column above, Requested_Ship, and compare it with the displayed output in the screenshots earlier in this post, you&#39;ll see that the data in the XML doesn&#39;t &quot;know about&quot; any of the formatting options you may have picked for display purposes in the RDL.&nbsp;\n<\/p>\n<p align=\"left\">\nThat&#39;s as expected.&nbsp; You can take care of this in the XSLT with a little more work &#8212; and you can provide more intelligence about the formatting for each column in your custom lookup element than I have &#8212; or you can change the SELECT statement for the special export version of the report to output the columns pre-formatted.&nbsp;\n<\/p>\n<p align=\"left\">\nThe &quot;real&quot; CSV handler would have handled this for you&#8230; but, come to think of it, in many cases the raw data item is going to be exactly what you would prefer for a separated values result.&nbsp; So we win, actually, we can have it either way.\n<\/p>\n<h5 align=\"left\">Before anybody asks<\/h5>\n<p align=\"left\">\nNo I haven&#39;t checked to see how this works in RS 2008.&nbsp; To tell you the truth, until the whole mess with the report viewer control versions and Visual Studio dies down, and unless a client wants to upgrade, I&#39;m not all that tempted.&nbsp; I would if I had any free time, but I&#39;d just be playing around.&nbsp; Meanwhile, the RDLs are not compatible and I&#39;m kinda busy with &quot;real&quot; work. I&#39;d rather spend my play-round time answering questions like Steve&#39;s (I get a few almost every day) for other people who are also doing &quot;real&quot; work.&nbsp;\n<\/p>\n<p align=\"left\">\n&quot;Faster would be better?&quot; Not this time, I don&#39;t think so.\n<\/p>\n<p align=\"left\">\n<em>Set curmudgeon mode off. <\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Steve&nbsp;Gavin wrote with an interesting question that, at first, I got backwards. He has a requirement for CSV export output from&nbsp;a report that conditionally hides columns, and he couldn&#39;t get the output the way he wanted it to be.&nbsp; I immediately thought,&nbsp;&quot;That makes sense, somehow the CSV renderer [and as it turns out, the XML&nbsp;renderer]<a class=\"more-link\" href=\"https:\/\/spacefold.com\/lisa\/2008\/08\/30\/a-bug-imho-and-a-workaround-for-conditional-column-export-scenarios\/\">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,10,12],"tags":[],"class_list":["post-125","post","type-post","status-publish","format-standard","hentry","category-reporting","category-sql-server","category-xml-xslt","category-yaps"],"_links":{"self":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/125","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=125"}],"version-history":[{"count":0,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/125\/revisions"}],"wp:attachment":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/media?parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/categories?post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/tags?post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}