accounts_8 Posted July 17 Share Posted July 17 Hi Community,I user Jasperreports to create a report book.Book, ToC, Contents, Custom Datasources etc. work like a charm. Also, ToC has correct numbering for bookmarks (1. Foo, 1.1 FooSub, 1.1.1 FooSubSub, 2. Bar, 2.1 BarSub etc.).But I failed to add the bookmark numberings to the heading itself. How can I get a heading - e.g. "FooSub" - to print "1.1 FooSub"? It seems like there is no Varaibale, Field or Parameter for that number.Thanks! Link to comment Share on other sites More sharing options...
Mehak Rajkumar Posted July 18 Share Posted July 18 Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times. Link to comment Share on other sites More sharing options...
Thomas Tibcken Posted July 19 Share Posted July 19 Hi, if you have multiple reports and sub-reports you find an example on how to create Page Numbers for the whole results here:https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-user-guide/v60/report-book-paginationyou can use the following syntax:"Page "+$V{MASTER_CURRENT_PAGE}+" of" " "+$V{MASTER_TOTAL_PAGES}and change the evaluation time of the element to "Master" Let me know if that will solve your problem. THX Regards TT Link to comment Share on other sites More sharing options...
accounts_8 Posted July 19 Author Share Posted July 19 Thank you for your quick response. Unfortunately, that doesn't fully answer my question.I want to access the heading number, not the page number.The picture should describe my problem.I Link to comment Share on other sites More sharing options...
Thomas Tibcken Posted July 20 Share Posted July 20 Hi, can you please share your TOC.jrxml?THX TT Link to comment Share on other sites More sharing options...
accounts_8 Posted July 20 Author Share Posted July 20 My TOC.jrxml is below :)<?xml version="1.0" encoding="UTF-8"?> ]]> </queryString> <field name="level" class="java.lang.Integer"/> <field name="label" class="java.lang.String"/> <field name="pageIndex" class="java.lang.Integer"/> <variable name="l2" class="java.lang.Integer"> <variableExpression><![CDATA[$F{level} == 1 ? 0 : ($F{level} == 2 ? ($V{l2} + 1) : $V{l2}) OR($F{level} == 1,$F{level} == 2) ? 0 : ($F{level} == 3 ? ($V{l3} + 1) : $V{l3}) $F{level} == 1 ? ($V{l1} + 1) : $V{l1} 0 OR($F{level} == 1,$F{level} == 2, $F{level} == 3) ? 0 : ($F{level} == 4 ? ($V{l4} + 1) : $V{l4}) "Inhaltsverzeichnis" new Boolean($V{PAGE_NUMBER}.intValue()>1) $P{heading2} $P{heading1} $P{logo} $F{level} == 1 $F{label} $F{label} $V{PAGE_NUMBER} + $F{pageIndex} + 1 $F{label} $V{l1} + "." $F{label} $F{level} == 2 $F{label} $F{label} $V{PAGE_NUMBER} + $F{pageIndex} + 1 $F{label} $V{l1} + "."+$V{l2} $F{label} $F{level} == 3 $F{label} $F{label} $V{PAGE_NUMBER} + $F{pageIndex} + 1 $F{label} $V{l1} + "."+$V{l2} + "."+$V{l3} $F{label} $F{level} == 4 $V{l1} + "."+$V{l2} + "."+$V{l3}+ "."+$V{l4} $F{label} $F{label} $F{label} $V{PAGE_NUMBER} + $F{pageIndex} + 1 $F{label} "Seite "+$V{MASTER_CURRENT_PAGE}+" von "+$V{MASTER_TOTAL_PAGES} $P{left_footer} [/code] Link to comment Share on other sites More sharing options...
accounts_8 Posted July 20 Author Share Posted July 20 ToC is listed in latest post.Regards, Christoph Link to comment Share on other sites More sharing options...
Thomas Tibcken Posted July 24 Share Posted July 24 we are trying to find a solution and ask for a little more patience, Regards TT Link to comment Share on other sites More sharing options...
Thomas Tibcken Posted July 26 Share Posted July 26 Hi, there is no "out of the box" and simple way to reuse the Numbering from the TOC in a report or sub-report, but there is a way to send the index information from the TOC to the reports used in the Workbook. Please find attached a Zip that contains an example with all needed files base on our sampledb and an example PDF that shows the final result using the numbering for 2 Level of the TOC like the one you are looking for. How to description:Open the Report Book and select the Report (1) edit Parameters (2) and add the Name: index (3) and the expression $V{REPORT_COUNT} + 1 (4)Using the the index from the TOC for Level 1 Titel in your ReportNow you can edit the expression for the Titel and add the $P{index} as first element like this:$P{index} + ". Shipments to " + $P{Country}Evaluation Time: NowTo generate a 2. Level Titel (for example 1.2 etc.) you have to generate a new Variable that will create the Number for each Sub-Group like this:In our Example Level 1 = Country and Level 2 = City To get the 2. Level Text (1.1 1.2. etc) you have to select the Group Field (1) open the Expression (2) and add the $P{index} and the new Variable $V{City_Index} to your Expression (3) like this:$P{index} + "."+($V{City_Index} + 1) + " " + $F{ShipCity}That is all you have to do to get the Numbering from the TOC to your Report Details.If you want a 3. Level you have to create an additional Variable that is linked to the Increment Type of the 3. Group of you Report. Please let me know if this will work for you. Regards TT Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now