COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: squish88 on 17 Dec 2013 10:49:49 AM

Title: SOLVED - Does PageNumber() not work in PDFs and/or XLS?
Post by: squish88 on 17 Dec 2013 10:49:49 AM
Hey guys,
   I put a render variable on a conditional block in a bunch of my reports to show a "report description" the users requested at the top of the first page of output only.  That variable was a simple PageNumber() = 1.  Though it doesn't seem to want to work for PDF's, and Excel outputs...  (ie. no description is coming out on the first page when output to those formats).  It works great in HTML though.   Am I missing something?  Is this just a rookie mistake?  Should I be using something else to accomplish this, or is it possibly a Cognos (10.2.0 FP1) bug?
  Thanks in advance for the help!!
Title: Re: Does PageNumber() not work in PDFs and/or XLS?
Post by: MFGF on 17 Dec 2013 11:58:27 AM
What happens if you include a layout calculation in the page header with an expression of Pagenumber() - does it display the expected number when you render as html / pdf / excel? Showing this might give you a clue as to whether or not it's returning what you expect while you figure out what the issue is.

MF.
Title: Re: Does PageNumber() not work in PDFs and/or XLS?
Post by: squish88 on 17 Dec 2013 01:07:45 PM
Yes, it does.
Title: Re: Does PageNumber() not work in PDFs and/or XLS?
Post by: navissar on 18 Dec 2013 05:44:07 AM
Hi,
This is a really weird behaviour, I was able to recreate it and do some further testing on 10.2. It seems that Cognos doesn't calculate the variable value when exporting the report.
It may be worth while to involve IBM support. Maybe there's a defect logged in deep in the stomach of IBM systems, or they can open one if there isn't.
In the meantime, here's a workaround: Since the report expression "PageNumber()" does work, you can set the description text like this:
create a layout calculation and in it put the following expression:
if(PageNumber ()=1) then ('This is a description text') else ('')
Replace 'This is a description text' with your description. This will actually work.
Title: Re: Does PageNumber() not work in PDFs and/or XLS?
Post by: squish88 on 18 Dec 2013 09:59:14 AM
That's an excellent workaround!!   Thank you very much for the help!!!
Title: Re: SOLVED - Does PageNumber() not work in PDFs and/or XLS?
Post by: pirx on 15 Jan 2016 10:52:15 AM
Hey!

I am facing the same problem, just I have to show a list in the header only the first page. The list is different is than the list which is in the page body and the layout calculation does not work for me. The report contains page set with along some id-s, thats why does not work for me tha pagination settings, because the list repeat every new pagebreak...
But maybe I am just missing some point.
Do you have any idea?

Thanks!
Title: Re: SOLVED - Does PageNumber() not work in PDFs and/or XLS?
Post by: Lynn on 18 Jan 2016 09:10:05 AM
If you can create a query calculation that resolves to the first value your page set will deliver then you can conditionally render based on that.

For example, let's say your page set is based on product name and sorted alphabetically. Your products are called 'Alpha', 'Bravo', and 'Charlie'.

Create a query calculation called 'First Product Name' and find the first one:


minimum ( [Product Name] for report )


Now you can use [First Product Name] compared to [Product Name] and only render your object when they match, which is only going to be true for the first page.
Title: Re: SOLVED - Does PageNumber() not work in PDFs and/or XLS?
Post by: maurizio.pavan-ext on 23 Dec 2024 05:02:50 AM
Hello,
Sorry to reply on this "solved" thread, but I'm new and not able to create new posts.
Here is my problem:
I need to create a bursting PDF report having an introduction as (Rich text item) on the first page only.
I've tried different ways bot none of them works
Report have 3 sections
1) Header
2) Introduction block
3) List

Looking forwards for any help
Thanks