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)
hiding columns
dzish
Hi,<br />
<br />
can somebody explain me one mysterious thing?<br />
<br />
I add to EventHandler code for hidding of some columns. It goes through but as result columns aren't hidden. I tried to put this code into IReportEventHandler, ITableEventHadler in all reasonable methods (onCreate, onPrepare, onRender, beforeFactory).<br />
<br />
thre is code snippet:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
ColumnHandle columnHandle = table.findColumn(Integer.valueOf(columnTableId));
HideRule hideRule = StructureFactory.createHideRule();
PropertyHandle visibility = columnHandle.getPropertyHandle(ITableColumnModel.VISIBILITY_PROP);
logger.debug("hidding of columns id= " + columnHandle.getIndex() + ", is editable= " + columnHandle.canEdit());
try {
visibility.addItem(hideRule);
logger.debug("hidden");
} catch (SemanticException e) {
String message = "Unable to hide column:" + columnTableId + " for table:" + table.getName();
throw new RuntimeException(message, e);
}</pre>
<br />
Logs are ok but columns are still visible.<br />
<br />
<br />
Jan
Find more posts tagged with
Comments
Hans_vd
Hi Jan,<br />
<br />
I don't have too much experience with this kind of stuff, but you're not providing any hiding rule, are you?<br />
Try adding this to your code:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
hiderule.setExpression("true");
</pre>
<br />
Regards<br />
Hans
dzish
Hi Hans,
thank you for response. Code is ok. Default expression is "true" for all formats. I had these explicit setting too but in snippet I tried not to set the values.
dzish
Hi all,<br />
<br />
solved. Problem was in row code<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>ColumnHandle columnHandle = table.findColumn(Integer.valueOf(columnTableId));</pre>
<br />
I changed to<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
int columnId = (new Integer(columnTableId)).intValue();
ColumnHandle columnHandle = table.findColumn(columnId);
</pre>
<br />
and it works. So maybe something wrong with autoboxing ...<br />
<br />
I add here working example with code in javascript if somebody in future wants.<br />
<br />
Jan
dzish
file example
neerajk
AM A NEW ACTUAE DEVELOPER SO PLEASE HELP ME!!!!!
now coming back to the issue...this is a simple sod file that I am modifying using e.SpreadSheet Designer...the report takes a user parameter of country values like USA, UK, IND
so the code is something like
if :country = 'usa'
select col1, col2, col 3 from table1 where :country = 'USA' ;
else if :country = 'UK
select col1,col3,col4, col4 from table 1 where :country = 'UK' ;
else....something like that
so when the xls report is generated for usa as parameter input by user
col1, col2, col 3
while it shows
col1,col3,col4, col4 for UK as parameter inputted by user
so the design of report may show
all columns but the columns get hidden or shown depending on the parameter.
Thanks,
Neeraj
neerajk
my email is nkandwal@gmail.com
Thanks,
Neeraj