If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

"PageNumber ()" make weird behaviour

Started by Enrique, 01 Aug 2016 10:21:31 AM

Previous topic - Next topic

Enrique

Hi everybody !!

I m trying to work with PageNumber() but i dont really understand what Cognos do.

theoretically if you PageNumber() return the number of pages your report have, and it work like that if we use it like a output report expresion with "<%PageNumber()%> "

the problem come when i use it in a boolean Variable expresion like "PageNumber () > 6 "

and cliking "Yes"  put a especific color.

my report have 3 pages and it still act like if they where 7 ( so enter in the condition to "YES" )

so i dont understand anything.

I know is a extrange Question but mybe someone had the same Problem before


thanks in Advance , Enrique




dougp

You may want to read the Information: pane in the expressino editor.  You'll notice that PageNumber() returns the current page number.  I think you want PageCount().

Keep in mind that PageCount() won't work in HTML output.  In fact, PageNumber() only works if you page through the report one page at a time.  As soon as you click the Bottom navigation button PageNumber() and PageCount() both return ?.

Lynn

My understanding is that conditions are evaluated prior to pagination and therefore you cannot base conditions on PageNumber() or PageCount().

This is a very old post on the topic but I'm not aware of anything having changed since.

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014197524

Enrique

#3
Hi

@dougp  sorry I  didnt express myselft correctly, Yes i want to use "PageNumber ()" i want to use the property to tell in wich page are you currently in a  Variable

for example

PageNumber ()  = 1

yes --> a text element color pink


the interesting thing here  it is that it work perfectly for HTML  so in a report of 3 page the page 1 the text element is in pink and not in the others pages so it work like it should worked.

But not in PDF. In PDF do what he want , ( a report of 1 page , a condition like PageNumber() >3 make it like true etc... i asume they would it fix in any future release .(mybe)

I read that before PageNumber ()  doesnt suport  boolean operations .


Thanks for the nice answer , Enrique

Enrique

Hi @Lynn


like you said in that post


"This is a program architecture issue and has been classed as design intent.
Currently any page dependent expression such as PageNumber (), PageCount ()
etc are not supported for all conditionals. Such as conditional formattin.. "


but that was with Cognos 8  in 2009 so after 7 years IBM i asume had do some improves one of them ist that it works for HTML but not for PDF

so a boolean condition with PageNumber() work with a html option ( PageCount() no because is just for pdf  and if you use it in a boolean condition it does what he wants  literally, I dont unerstand his logic )


Thanks for answer :))

Lynn

Assume at your own risk  ;)

What you are describing today in 2016 is exactly the behavior I experienced in 2009. It worked in html but not for PDF. The explanation was as you saw in the post.

There are other posts on this forum and elsewhere that provide alternative approaches. One is to use separate page layouts. Another is to figure out via a running-count in the query which rows are applicable to page1 and then use the running-count to style accordingly. This assumes you can consistently determine this which may or may not be the case in your situation.