Question
Con Skordis · Jul 20

Zen Report page number variable

I have a report that requires a different header block for the first page and another for subsequent pages.

Is there a way to direct a header page to another header page  based on what the current page number is?

 

Product version: Caché 2018.1
00
2 0 5 54
Log in or sign up to continue

There are two ways to use <pagemaster> and <masterreference> - (1) such that it encompasses your entire report or (2) the page details get reset for each entry in a group.

1. Have page 1 have one header/footer, and the rest of the report a different one

<report  define report details >

<pagemaster >
<masterreference masterReference="first" pagePosition="first">

<document  define document details> add styles</document>

<pageheader> define pageheader </pageheader>

<pagefooter> define pagefooter</pagefooter>
</
masterreference>

<masterreference masterReference="rest" pagePosition="rest">

<document  define document details> add styles</document>

<pageheader> define pageheader </pageheader>

<pagefooter> define pagefooter</pagefooter>
</
masterreference></
pagemaster><body report body here>
 

2. For each group in my xml have a specific first page, and then the rest all be something else

In my XML definition I have a group Sales and inside that group I have another group called SalesRep - the SalesReps are uniquely identified via an attribute I have defined as name

<report  define report details >

<section name="report name here" sectionName="Sales" primaryGroup="Sales/SalesRep">

<pagemaster >
<masterreference masterReference="first" pagePosition="first">

<document  define document details> add styles</document>

<pageheader> define pageheader </pageheader>

<pagefooter> define pagefooter</pagefooter>
</
masterreference>

<masterreference masterReference="rest" pagePosition="rest">

<document  define document details> add styles</document>

<pageheader> define pageheader </pageheader>

<pagefooter> define pagefooter</pagefooter>
</masterreference>

</pagemaster>
<body genLastPageIdOn="@name">

<group name="Sales/SalesRep" primaryGroup="true">

Report details here

</group>
</body>
</section>

Hope this helps.

Thanks Julie.

I was hoping to use some type of page variable to drive what type of header to use but if that variable is not accessible I will have to use some other logic within the Zen template.

Thanks Julie.

I was hoping to use some type of page variable to drive what type of header to use but if that variable is not accessible I will have to use some other logic within the Zen template.

The page number used is <fo:page-number/>  which wouldn't be available in xslt so you wouldn't be able to do any xsl:when or xsl:if statements related to it.  You could define multiple <section> and give each section its own header