Home
Analytics
Page Number and Total Page Count
Megha Nidhi Dahal
Hi All,<br />
<br />
The designer gives us the Page, Total Page count etc... as an Auto Text that can be used in the report.<br />
Is there any hook(variables) to these Auto Text items so that I can use them in expressions?<br />
<br />
I tried <strong class='bbc'>pageNumber</strong> and <strong class='bbc'>totalPage</strong> but both of these returns 1.<br />
<br />
I basically need these values to build an expression to make some of the items in the report to be visible / invisible.<br />
<br />
Eg: I want the header only at the first page and footer only at the last page etc...<br />
<br />
Any other methods to achieve my requirement is also welcomed but do help me out to understand this approach too.<br />
<br />
Any help in this regard would be really helpful.<br />
<br />
regards<br />
Arpan
Find more posts tagged with
Comments
KavithaD
Hi Arpan,
you can do something like this for display header info in first page ,in header Label script onRender method ,
if(pageNumber > 1){
this.getStyle().display ="none"
}
For displaying footer in last page, in footer grid script onRender method ,
if(pageNumber < totalPage){
this.getStyle().display ="none"
}
Hope this may help you,
Thank you,
Kavitha
Megha Nidhi Dahal
Hi Kavitha,
I tried using these two variables (whatever would their technical name be
). I used them to build a visibility expression where suppose I say:
if(pageNumber != totalPage)
true
else
false
But it didn't work out. I think I should try that with scripts like the way you suggested.
Thanks for the response.
regards
Arpan
arya
<blockquote class='ipsBlockquote' data-author="'KavithaD'" data-cid="67121" data-time="1281088481" data-date="06 August 2010 - 02:54 AM"><p>
Hi Arpan,<br />
<br />
you can do something like this for display header info in first page ,in header Label script onRender method , <br />
<br />
if(pageNumber > 1){<br />
this.getStyle().display ="none"<br />
} <br />
<br />
For displaying footer in last page, in footer grid script onRender method ,<br />
<br />
if(pageNumber < totalPage){<br />
this.getStyle().display ="none"<br />
} <br />
<br />
Hope this may help you,<br />
<br />
Thank you,<br />
Kavitha<br /></p></blockquote>
<br />
<br />
Hi Kavitha <br />
I have tried this onrender method in footer<br />
if(pageNumber < totalPage){<br />
this.getStyle().display ="none"<br />
}<br />
<br />
its working fine while executing the report,but when im exporting in pdf its is not displaying <br />
is their any other solution<br />
please help me out
johnw
In the onCreate method for your report item, use the following script:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (pageNumber > 1)
{
this.getStyle().display = "none";
}
</pre>
<br />
If you use it in the onRender event, you are only setting the HTML property, and in any emitter except HTML this property has no meaning. If you do it in the onCreate, it is setting the report item style during layout.<br />
<br />
There are some caveats to this, such as it might not work correctly in the Master Page, but for general report items in the design it will work fine.<br />
<br />
See the attached example. The date column will not show up on any page past the first page.
blockbasta
<blockquote class='ipsBlockquote' data-author="'johnw'" data-cid="97621" data-time="1331661565" data-date="13 March 2012 - 10:59 AM"><p>
In the onCreate method for your report item, use the following script:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (pageNumber > 1)
{
this.getStyle().display = "none";
}
</pre>
<br />
If you use it in the onRender event, you are only setting the HTML property, and in any emitter except HTML this property has no meaning. If you do it in the onCreate, it is setting the report item style during layout.<br />
<br />
There are some caveats to this, such as it might not work correctly in the Master Page, but for general report items in the design it will work fine.<br />
<br />
See the attached example. The date column will not show up on any page past the first page.<br /></p></blockquote>
<br />
Hi John,<br />
<br />
i also tried to hide the footer content after the frontpage. How can i hide it within the Master Page?<br />
<br />
The Script (testet with "onRender", "onPrepare" and "onCreate") doesn't work.<br />
<br />
if (pageNumber > 1)<br />
{<br />
this.getStyle().display = "none";<br />
}<br />
<br />
What ca i do? Thanks in advance