Change Crosstab column width in onCreate event.

Scarlett
edited February 11, 2022 in Analytics #1
<p>Hello,</p><p> </p><p>I'm trying to set the width of a column on my crosstab to 0px (hide it), based on a condition which includes data from the crosstab. </p><p> </p><p>reportContext.getDesignHandle().getElementByID(6395).setStringProperty("width", "0px");</p><p>--works perfectly in the onPrepare event. However, I need access to a globalvariable that's being set in the onFetch event of a dataset (which I believe runs AFTER the onPrepare event).</p><p> </p><p>Is there any way to set the width of the column in the onCreate event. Given my limited knowledge on BIRT, I believe the onCreate event has access to the data from the Crosstab and also runs after onFetch (which allows me to access my globa'variable).</p><p> </p><p>And for some reason:</p><p>reportContext.getDesignHandle().getElementByID(6395).setStringProperty("width", "0px");</p><p>-- does not work in the onCreate event.</p>

Comments

  • <p>Can you post your report design?  If you want to hide a column in a crosstab depending on the values and how you're report is setup you might be able to create a computed column and build your data cube from this.</p>
    Warning No formatter is installed for the format ipb
  • Scarlett
    edited August 16, 2013 #3
    <p>Hi kclark,</p><p> </p><p>My report has a lot of customer data, so I apologize I won't be able to upload it. However, I can tell you what it looks like, if that helps.</p><p> </p><p>I've attached a screenshot of a sample report. The report shows 2 Dimensions. However there can be upto 10.</p><p>What I need to do is to show the Percent column for Dimension 1.1 and Dimension 2.1 ONLY (and remove the column for Dimension 1.2 and Dimension 2.2)</p>
  • sschmidt.evalue
    edited July 7, 2014 #4
    <p>I have this exact same problem.  I need to hide or show dimension columns based on user content from the dataset.  I can setPersistentGlobalVariable in the onFetch, but that doesn't happen until AFTER the onPrepare event of the crosstab.  So, coding the setStringProperty in the onPrepare is too early to be useful to me.</p><p> </p><p>And setStringProperty doesn't do anything when I put it in onCreate or onRender.</p><p> </p><p>Setting the display and visibility works fine for HTML and/or the viewer, but leaves big empty columns in Excel and some of the other export formats.  I need to set the width to 0 in order to completely hide the columns when appropriate.</p><p> </p><p>I've attached a mock-up using the sample database.  The net result in this example is that it hides the column when it shouldn't, because the value of SHOWSCALE is false (the default) in the onPrepare block.  It gets set to true in the onFetch of the dataset.</p><p> </p><p>Therefore, I need a technique to set the cell Width in the onCreate or onRender events of the crosstab because that's after my global variable is set one way or the other.</p>