tag:blogger.com,1999:blog-16506996.post760295852792695560..comments2024-02-08T01:57:07.944-07:00Comments on The Digital Voice: BIRT: Using Reflection to get Total Page CountJohn Wardhttp://www.blogger.com/profile/10741149622435353727noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-16506996.post-47475034475158491522011-02-11T11:28:26.539-07:002011-02-11T11:28:26.539-07:00I am not sure that is possible in BIRT 2.1.2. In l...I am not sure that is possible in BIRT 2.1.2. In later versions, it is possible to just create a simple script that will hide the page number by putting something in the onRender event. So it would be something like:<br /><br />onRender:<br />//pageNumber is a variable available at render time<br />if (pageNumber == 1)<br />{<br /> //not the exact syntax<br /> this.getStyle().hidden = true;<br />}<br /><br />Then you would create a simple master page footer with pageNumber - 1;John Wardhttps://www.blogger.com/profile/10741149622435353727noreply@blogger.comtag:blogger.com,1999:blog-16506996.post-20503896535688827662010-12-24T01:27:52.401-07:002010-12-24T01:27:52.401-07:00Is this working for birt 2.1.2???
I need page re-...Is this working for birt 2.1.2??? <br />I need page re-numbering feature for my report, since I dont want my 1st page have a page number on it. But the page number and the total page must exist for the next page and the rest.<br />Therefor if I have 3 pages, page number 1 exist in 2nd page and the total page should be 2 not 3.<br />How can I make this??Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-16506996.post-32259407778630504992010-06-15T10:28:32.833-06:002010-06-15T10:28:32.833-06:00I confirm with 2.5, this solution works only in Ru...I confirm with 2.5, this solution works only in Run + Render. ReportDocument exists only after a IRunTask.<br /><br />public class TSCReportEventAdapter extends ReportEventAdapter {<br /><br /> public void initialize(IReportContext context) throws ScriptException {<br /> super.initialize(context);<br /> }<br /> <br /> private ExecutionContext execContext;<br /><br /> <br /> @SuppressWarnings("unchecked")<br /> public void beforeRender(IReportContext context) throws ScriptException {<br /> <br /> super.beforeRender(context);<br /><br /> Class rciClass = context.getClass();<br /><br /> Field contextField;<br /> try {<br /> contextField = rciClass.getDeclaredField("context");<br /> contextField.setAccessible(true);<br /><br /> execContext = (ExecutionContext) contextField<br /> .get(context);<br /><br /> // Now, we have the exeuctionContext. We can get the currently rendering<br /> // report documents location<br /> IReportDocument doc = execContext.getReportDocument();<br /> if (doc != null) {<br /> long pageCount = doc.getPageCount();<br /> context.setGlobalVariable("totalPageCount", String.valueOf(pageCount));<br /> <br /> }<br /> } catch (SecurityException e) {<br /> throw new RuntimeException(e);<br /> } catch (NoSuchFieldException e) {<br /> throw new RuntimeException(e);<br /> } catch (IllegalArgumentException e) {<br /> throw new RuntimeException(e);<br /> } catch (IllegalAccessException e) {<br /> throw new RuntimeException(e);<br /> }<br /><br /> }<br /><br />}devantorhttps://www.blogger.com/profile/08351941761355972077noreply@blogger.comtag:blogger.com,1999:blog-16506996.post-63601559708484449632009-09-16T15:11:01.671-06:002009-09-16T15:11:01.671-06:00Nope. The above example was tested with BIRT 2.3.2...Nope. The above example was tested with BIRT 2.3.2, 2.3.2.2, and 2.5.John Wardhttps://www.blogger.com/profile/10741149622435353727noreply@blogger.comtag:blogger.com,1999:blog-16506996.post-5935120893982784862009-09-16T01:53:04.057-06:002009-09-16T01:53:04.057-06:00can't use java reflection with birt 2.2.2 or 2...can't use java reflection with birt 2.2.2 or 2.3.2. Is there something special to do ?<br /><br />thanksvcartonnoreply@blogger.comtag:blogger.com,1999:blog-16506996.post-50095692109337537602009-07-17T15:32:23.996-06:002009-07-17T15:32:23.996-06:00It will work with either the Run And Render or the...It will work with either the Run And Render or the Run Then Render methods. The global variable is set in the beforeRender event, so it will be available throughout the entire render phase regardless of which task is used. If it were being set in the beforeFactory event, this would be true, but the report document reader is not instantiated during the run phase. It was tested with both.John Wardhttps://www.blogger.com/profile/10741149622435353727noreply@blogger.comtag:blogger.com,1999:blog-16506996.post-3846150412445504842009-07-17T07:39:51.275-06:002009-07-17T07:39:51.275-06:00That will only work if you are doing a RunAndRende...That will only work if you are doing a RunAndRender operation. If you are doing Run then Render to build your report, you should use <br /><br />setPersistentGlobalVariable<br /><br />Probably best to always use persistent unless there is a specific reason for wanting different behavior in render then run.Anonymousnoreply@blogger.com