Home
Analytics
get Page Number
mrkareka
Hi,
I have a problem that i don't know if it's possible to solve in BIRT, and i'm gratefull if somebody can help me.
My problem is that, i'm trying to hide my footer after my first page, and i'm not sure how to do it. I'm using only one master page, and i'm trying to hide footer with javascript, but my development is not working. Is possible do what i want ? In some consulting on the internet i see a lot of people with problems in that point.
I apologyze myself for my english, that is not very good.
Thank for any help,
Joao Vilar
Find more posts tagged with
Comments
mwilliams
In the onRender script of the elements in your MP footer, you should be able to put:
if (pageNumber > 1){
this.getStyle().display = "none"
}
Let me know if this does not work.
mrkareka
Hi again,
Before anything I want to say thank you for your response.
The problem continues and in some more search i see that maybe the problem could be also that fact that i'm trying to export my report to PDF format.
In the code maybe the problem can be that var pageNumber, that I don't know how Birt get the value. In some tests that i've done too, i have used sometimes that pageNumber var and the result has been the same.
To try that i've joined the page number property to the page, to try to get the value of the current page, but i've no lucky.
I remember that my objective is show footer grid only on first page and hide on the others.
One more time, i want to say thank you for your help and for any response that you can give to me.
Best Regards,
Jo?o Vilar
mwilliams
There is a bug with this in 2.6.1, where the page break events don't get called correctly, I believe. This is corrected in 2.6.2. For this report, since the line heights are fixed for each row, if you set the page break interal of the table to 32, it works as expected.
mrkareka
Hi again!
After some tests it doesn't work even.
I've tried to add a new page and report variable to simulate the pagination and ir doesn't work too.
In so many tries i had, i can see that the problem is that, in MP the variable has always the same value, as the pageNumber properties. It always get value=1, but i have a label in the layout of the page, and the value of it changes as required.
My solution after that was try to hide the element footer using the condition var['xpto'] > 1, but it doesn't worked also.
Can you explain me how the auto text for pagination works (cause it works good in header and footer)?
or
Can you seen any solution to this problems ?
As apointment, i'm using now the 2.6.2 version of BIRT as you recommended.
One more time, i want to say thank you for your help,
Best Regards,
Jo?o Vilar
mwilliams
Does the problem occur if you use the pageNumber > 1 check when you run it in the web viewer and export to PDF from there? If not, it's a runAndRender vs separate run and render task issue, which you can handle when you deploy your reports by using the "frameset" call in your URL rather than "run".
mrkareka
hey
i solve the problem with the page break interval and adding a page variable. i put also some code on the grid of the footer, at on render event:
if (parseInt(reportContext.getPageVariable("previousPageTotal")) > 0)
{
this.getStyle().display = "NONE";
}
also put some code on master page , on page end event:
reportContext.setPageVariable("previousPageTotal",1);
and adding page break interval to the table that i want to extend to other pages with data.
now the problem is that in second and following pages i want to modify the page break interval, so the table will be written on the footer space( footer grid is hidden).
i think that can solve the problem but i dont know how to do it.
i tried to change the property value with some examples on internet but without sucess.
answering to your question, when i run the web viewer there was 2 pages, and the footer show only on first, but when i export to pdf , the footer show on both pages.
best regards
joao vilar
mwilliams
If you can't get it solved with page break intervals, etc. You could use different master pages, create a computed column in your dataSet to do a "runningcount" of the rows. Then, in your design, put two identical tables and use filters to filter the first table to only show rows where your runningcount field is less than n. Attach this element to the first masterpage with the footer. Force a page break after this table and attach the next table to the second masterpage and add a filter that causes this table to only show rows n and up. Just an idea that might solve your issue since you're having an issue with the other way. Let me know.
mrkareka
hey
i solve the problem with that way. i put 2 masterpages, and in first master page, my table filter the first 22 records , and the second master page, the table get the other records, so it works fine
i also put visibility condition on table of 2? master page, so that when there is only 22 records, the report has only the first page .
there was no need to put some code on scripting, and it was easy to put header and footer on firts master page and just header on second.
thank you very much for your help
best regards
Jo?o Vilar
mwilliams
Not a problem at all. Let us know whenever you have questions!