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)
Access pageNumber and totalPage in scripting in layout body and not masterpage.
jsekhon
<p><span style="color:#1f497d;">1) Is there a way to access pageNumber in scripting in layout body and not masterpage.</span></p>
<p> </p>
<p><strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">if</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> (pageNumber == 1) {</span></span></span></p>
<p> <strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">this</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.text = </span></span></span><strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">this</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.text + </span></span></span><span style="color:#2a00ff;"><span style="font-family:consolas;"><span style="font-size:10pt;">"; page: "</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> + pageNumber + </span></span></span><span style="color:#2a00ff;"><span style="font-family:consolas;"><span style="font-size:10pt;">"/"</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> + totalPage;</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">} </span></span></span><strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">else</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> {</span></span></span></p>
<p> <strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">this</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.text = </span></span></span><span style="color:#2a00ff;"><span style="font-family:consolas;"><span style="font-size:10pt;">"page: "</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> + pageNumber + </span></span></span><span style="color:#2a00ff;"><span style="font-family:consolas;"><span style="font-size:10pt;">"/"</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> + totalPage;</span></span></span></p>
<p> <strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">this</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.text = </span></span></span><strong><span style="color:#7f0055;"><span style="font-family:consolas;"><span style="font-size:10pt;">this</span></span></span></strong><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">.text + </span></span></span><span style="color:#2a00ff;"><span style="font-family:consolas;"><span style="font-size:10pt;">"; number: "</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;"> + </span></span></span><span style="color:#2a00ff;"><span style="font-family:consolas;"><span style="font-size:10pt;">"123-456"</span></span></span><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">;</span></span></span></p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">}</span></span></span></p>
<p> </p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">This code works fine onRender in Header.</span></span></span></p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">I want to use some logic in Body using pageNumber variable. Is it possible.</span></span></span></p>
<p> </p>
<p> </p>
<p><span style="color:#000000;"><span style="font-family:consolas;"><span style="font-size:10pt;">2) Second is it possible to turn header repeatability off. Header should display for some pages and not all.</span></span></span></p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
mwilliams
Are you using separate run and render tasks (from designer you'd need to run in viewer and change format URL parameter to your output format or run in desired output format and change preview/run in URL to frameset)? What is your BIRT version?
jsekhon
<p>My question is this. </p>
<p> </p>
<p>How do I determine the pageNumber of a page if my layout is not in the Maaterpage.</p>
<p>pageNumber and TotalPages do not work in render when the report element is not in header.</p>
<p>I need to hide some borders depending on the pageNumber I am in.</p>
<p>All the logic is in scripting.</p>
<p> </p>
<p>I am using Luna Release 4.4.0</p>
jsekhon
<p>I am not using seperate RunandRender Tasks.</p>
<p> </p>
<p>Please help.</p>
mwilliams
If you set a page break interval and your rows were a consistent height that would follow this interval, you would know what page you were on by the row number. Could you describe in detail what you're wanting to do? I can try to do something.
jsekhon
<p>we have ticks on the headers. small lines for folding on invoices and adding inserts. </p>
<p>The first page has one tick in the header and 2nd page has 2 ticks in the header.</p>
<p>For that I need to know the current page number . If I put the ticks in the header , I know the current page number and I can hide the ticks using scripting.</p>
<p>But I don't want to repeat the header information to other pages of the report.</p>
<p>If I move the ticks to layout then I have no way to determine the current page number.</p>
<p>The report is an invoice and I can't determine the page break count.</p>
<p> </p>
<p>Please help.</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p>Jaslin </p>
mwilliams
If you set a variable to 1 in your initialize method and increment it in the onPageBreak, it'll increment one time (displayed in the detail row of the table in a dynamic text box). It shows up a couple rows late into the second page, but it does increment once. Not sure if this will help or not, but really, probably the only way you'll get what you're wanting is by using separate run and render tasks.
jsekhon
<div>if(pageNumber != 1){</div>
<div>this.getStyle().backgroundColor = "BLACK";</div>
<div>}</div>