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)
Bookmarks in PDF
pandersson
Hello everybody,
I am generating a pdf-report using Birt 2.6.1. I try to add a TOC programmatically using the following expression:
DataItemHandle data = designFactory.newDataItem(null);
data.addTOC("if (!BirtComp.compareString(row[\""+reportColumn.getName()+"\"],\"\")){\"\"+row[\""+reportColumn.getName()+"\"];};");
What I am trying to achieve is to add a TOC-entry/bookmark ( which will become a bookmark in the pdf ) on every DataItemHandle that that has a value ( not equal to ""). Using the expression creates the bookmarks I want but also creates bookmarks for DataItems with value "".
Anyone now how to do this?
Or could this be achived by writing an EventHandler?
Regards Peter
Find more posts tagged with
Comments
mwilliams
Hi Peter,
I remember seeing something like this before. I don't rememeber what the outcome was though. I'll search the forum to see if I find it. Does filtering out the rows where there is only "" for the value work? Or is this not an option?
pandersson
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="71113" data-time="1291740517" data-date="07 December 2010 - 09:48 AM"><p>
Hi Peter,<br />
<br />
I remember seeing something like this before. I don't rememeber what the outcome was though. I'll search the forum to see if I find it. Does filtering out the rows where there is only "" for the value work? Or is this not an option?<br /></p></blockquote>
<br />
Hi Michael,<br />
<br />
thanks for your reply. Sorry for my late answer but I thought that I would get a notification when I got a reply on my post.<br />
I?m not sure what you mean by "filtering out the rows where there is only "?<br />
Maybe I could clarify what it is I am trying to achieve.<br />
<br />
I have got a report looking as below ( the grouping logic is done outside of Birt ):<br />
<br />
Col1 Col2<br />
value11 Value21<br />
Value22<br />
Value33<br />
Value12 Value34<br />
Value35<br />
.....<br />
<br />
When I view the report as pdf i would like to get value11 and value22 as bookmarks and if grouping also on col2 I would like to have a bookmark herarchy like<br />
value11<br />
value21<br />
value22<br />
...<br />
value12<br />
value34<br />
....<br />
<br />
Thanks for your help.<br />
<br />
Kind regards<br />
Peter
mwilliams
Ok, so where do the "" values come in? When you group by the second column and there are no values in the second column for a particular row?
pandersson
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="71531" data-time="1292862845" data-date="20 December 2010 - 09:34 AM"><p>
Ok, so where do the "" values come in? When you group by the second column and there are no values in the second column for a particular row?<br /></p></blockquote>
pandersson
Hi,
the formatting in my previous post dissapeared so it not very clear what I mean. I will try to explain it in words instead.
When I group on the first column and have say three rows with the value value11 in the first column then only the first cell in col1 will display a value and the remaining two cells will be empty, and this is what I mean by "".
The report would look something like this:
<code>
Col1_______Col2
Value11____Value21
___________Value22
___________Value23
</code>
I have also attached an example of a pdf report ( not a very beautiful one ).
mwilliams
Gotcha! Yeah, that formatting issue didn't help my understanding!
I'll see if I can come up with something similar with the sample database that doesn't show the "" values in the PDF TOC.
mwilliams
So, if there is a column 1 value for each row, are you just using "suppress duplicates" rather than grouping? Or is the grouping outside of BIRT doing this already and passing in blank values for the duplicates of column 1?
pandersson
Hi!
Yes, the duplicates are suppressed outside of Birt using logic used for another presentation form.
Thanks for showing interest in my problem
Regards Peter
mwilliams
Peter,
If you have the data passed in in the correct order, you could simply make a computed column in BIRT that "unsuppresses" the suppressed column in another column. Then, you can use that column rather than your "suppressed" one. This will allow you to take advantage of BIRT's grouping and auto TOC values.
pandersson
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="71599" data-time="1292962237" data-date="21 December 2010 - 01:10 PM"><p>
Peter,<br />
<br />
If you have the data passed in in the correct order, you could simply make a computed column in BIRT that "unsuppresses" the suppressed column in another column. Then, you can use that column rather than your "suppressed" one. This will allow you to take advantage of BIRT's grouping and auto TOC values.<br /></p></blockquote>
<br />
Michel,<br />
<br />
I can choose to get the data "unsuppressed" so that is not a problem. The problem is that the data I get also contains sums (and perhaps ohter computations) and group footer text as for example "Sum 2010". Because they are part of the incoming data they will be grouped with the real data wich is not good
. Or is it perhaps possible to exclude rows from grouping and use them as as group footer text?<br />
<br />
I could perhaps filter out the sum rows but then I have to duplicate the code that does computations which I do not want.<br />
I would very much prefer to create the toc using the javascript that I originally posted, it seemed so easy and straight forward
.<br />
<br />
Thanks again for your time!<br />
<br />
Regards Peter
mwilliams
Peter,
I've been working on this for the last hour trying to find an expression to make this work. It seems that as soon as you put an expression in for the TOC, a bookmark is created for each row, your expression only changes the name tied to the bookmark at this point.
It seems that the only way to do this currently will be to go the other route. If I find anything else, I'll let you know, but this looks like something you'll need to add an enhancement request for. You can do that at
http://www.birt-exchange.org/org/resources/bug-reporting/
.
pandersson
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="71632" data-time="1293028925" data-date="22 December 2010 - 07:42 AM"><p>
Peter,<br />
<br />
I've been working on this for the last hour trying to find an expression to make this work. It seems that as soon as you put an expression in for the TOC, a bookmark is created for each row, your expression only changes the name tied to the bookmark at this point.<br />
<br />
It seems that the only way to do this currently will be to go the other route. If I find anything else, I'll let you know, but this looks like something you'll need to add an enhancement request for. You can do that at <a class='bbc_url' href='
http://www.birt-exchange.org/org/resources/bug-reporting/.'>http://www.birt-exchange.org/org/resources/bug-reporting/.</a><br
/></p></blockquote>
<br />
Michael,<br />
<br />
yeah, so it seems. I have tried to use IText to remove the empty bookmarks as a workaround but have not got it to work (yet anyway). I will add an enhancement request for this after the holidays.<br />
<br />
Once again thanks for your help and time.<br />
<br />
Kind regards Peter