Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Hide Crosstab column based on computed column aggregate in dataset
sisko7979
<p>Hi there,</p><p> </p><p>I am trying to hide a column in a crosstab based on the aggregate of a computed column in the dataset that is also used for the crosstab in one of my reports.</p><p> </p><p>Please find attached a simple example based on the Classic Models database that only contains one crosstab to illustrate the problem.</p><p> </p><p>I managed to hide the column "City" by inserting a script in the onPrepare section of the crosstab, but due to my lack of scripting knowledge I could not get the rest working.</p><p> </p><p>In the underlying dataset "ds_orders_per_customer" the last column "CheckNumber" is computed. I would like to hide the column "City" of the crosstab, if the aggregated sum of the column "CheckNumber" equals 0.</p><p> </p><p>I'm using Eclipse 3.5.1.</p><p> </p><p>Thanks a lot,</p><p>Sisko</p>
Find more posts tagged with
Comments
sisko7979
<p>Hi,</p><p> </p><p>I tried various things myself. Unfortunately it does not work, because the command for "hiding" the cross tab column</p><pre class="_prettyXprint">reportContext.getDesignHandle().getElementByID(47).setStringProperty("width","0px"); //CrossTab Column City</pre><p>needs to be in the onPrepate statement. At that stage the dataset data is not yet available to be read and used in a script.</p><p> </p><p>I think a different way might be possible - Using a scripted dataset as the dynamic source of a report parameter. I assume that a dataset for a parameter will be executed early enough. I have three sticking points though:</p><p> </p><p>1. How to read an existing "normal" dataset (or parts of it) in a global persistant variable. In the example attached let's say totalPrice and CheckNumber.</p><p>2. Sum up the check numbers. I assume some kind of loop is needed.</p><p>3. Write the sum to a scripted dataset with one column: Checksum</p><p> </p><p>Code snippets for the three steps would be very helpful and much appreciated.</p><p> </p><p>Then I would create a parameter based on Checksum and change the script in the OnPrepare section to refer in the if statement to that parameter. Maybe that works.</p><p> </p><p>Thanks a lot,</p><p>Sisko</p>
kclark
<p>I haven't tested it yet, but I think you should be able to set the style to "none" from the onCreate(). First check the value of the column header, if it meets your logic then set the style to none, then you could create a PGV and check that PGV later in your cross tab to set the rest of them to none also.</p>