COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: aravind006 on 02 Feb 2016 05:20:09 AM

Title: Get page numbers in javascript
Post by: aravind006 on 02 Feb 2016 05:20:09 AM
Hi,

I want to get the page numbers from the cognos report, using javascript.
please let me know your suggestions.

Thanks ,
Aravind
Title: Re: Get page numbers in javascript
Post by: BigChris on 02 Feb 2016 05:51:14 AM
I don't think that's possible, but someone more schooled in JS than me might be able to give you a solution. The page numbers are only rendered when the report is run, based on the number of lines per page etc. which is why in HTML format it doesn't know how many pages there are in the as a whole.
Title: Re: Get page numbers in javascript
Post by: afzaki7 on 03 Feb 2016 05:32:31 AM
Hi,

you can surround the PageNumber  by a div
put a PageNumber control from toolbox then put two HTML one before the PageNumber and the other after it

then in the first HTML put

<div id="pageNumber">

and in the second HTML put

</div>


then add another HTML wherever you want and put code like that

script>
function showPageNumber()
{
     var pageNumber = document.getElementById("pageNumber").firstChild;
     alert(pageNumber .innerHTML);
}
</script>
<button type="button" onclick="showPageNumber();" > Click Me!</button>


so you can alert the page number
use it as you want after that