How to hide crosstab columns at runtime (in Excel) [message #896524] |
Wed, 18 July 2012 12:45  |
Eclipse User |
|
|
|
Hello,
I am trying to hide columns (levels) that don't have data in a crosstab. But the only way I can find to actually remove the column when exporting to Excel is to change the column width to 0.
However, I also have header labels in a grid (tried table as well) above the crosstab levels that will also need to set the column with to 0 for the same column below it.
I can get the columns to hide in script, but since setting the column width appears to be required in the onPrepare event for the column (anything later than this won't change the column width), I don't know how to see if there is data in the dataset before this happens.
I tried a hidden table above this table to calculate the existence of data, but I can't seem to get it to work.
Any help is greatly appreciated.
|
|
|
|
|
|
|
|
|
|
Re: How to hide crosstab columns at runtime (in Excel) [message #897634 is a reply to message #897583] |
Tue, 24 July 2012 16:16  |
Eclipse User |
|
|
|
Matt,
If you do not mind using a hidden element you could paste the same xtab
in the report twice. Use the code I showed you earlier to hide the
row/column in the crosstab in both. In the first xtab hide it using
visibility rules and in the script that hides the row/col set a
persistentGlobal variable using
reportContext.setPersistentGlobalVariable("hidetablecol",
"columnnametohide");
Then in the second crosstab in your table put a visibility expression on
the column that checks the value of the persisted global variable.
Jason
On 7/24/2012 11:19 AM, Matt Rhoads wrote:
> Having a hidden table above is okay (unless it affects the output to
> Excel). Not worried about performance.
>
> But when I tried using a hidden table, I was still unable to make it work.
>
> The desired output will be a simple Excel report (with headers), but it
> needs to hide any column that doesn't have data (only columns on the
> left side of the crosstab...not the dynamic columns).
>
> I can achieve the desired output by setting the column with to 0 in for
> both the header table column and the crosstab cell, but I can't get the
> information (whether to hide it or not) before the OnCreate method of
> the header table. Does the OnCreate method fire for all controls before
> the OnFetch fires for any datasets? That seems to be what I am running
> in to.
>
> If this post only added more confusion, please let me know and I will
> try to post a more accurate report of what I am seeing...
>
> Thanks again!
>
> Matt
|
|
|
Powered by
FUDForum. Page generated in 0.02536 seconds