Zen Reports: page-number-of-with-xpath Unresolved ID reference

104 views
Skip to first unread message

Derek Day

unread,
May 3, 2013, 12:48:33 PM5/3/13
to intersys...@googlegroups.com

Hi, I am attempting to get page numbering working for a report. The main group for the report is made up of two parent elements, and the page numbering is supposed to use the final page output for each of the elements as the “last page”.

 

I am receiving the following WARNING and getting page number that looks like ‘n of <blank>’ (e.g. ‘2 of ‘):

May 3, 2013 12:21:05 PM org.apache.fop.events.LoggingEventListener processEvent

WARNING: Page 123: Unresolved ID reference "d1e10978" found.

 

Based on the documentation I think this is because I need to use the appendToZenLastPage attribute (but I may also need to be using sections). So my question is where do I need to use this when what value do I specify?

2012.2 Docs: 4.16.1 Page Numbering in Multi-section Reports

Page Numbering in Multi-section Reports

In order to calculate a total page count, Zen reports generates a last-page marker. In a report with multiple independently-numbered sections, each section has a last page, so for the purposes of page numbering, there are multiple last pages in the report.  When the report <body> element has appendIdToZenLastPage set to true, the report appends the <body> element’s id value to the last page marker for the section in order to generate a unique last-page marker. When you use the <item> attribute special to add page numbers and page counts, you use appendToZenLastPage to identify the last page marker for the section that contains the item. Therefore, the value supplied in appendToZenLastPage must match the id value of the <body> element of the section.

For details on the interaction of the special attribute with field and value, and their interaction with the expression attribute, see the section “Conditional Expressions for Displaying Values. ”

 

I do not have any sections. I’m guessing that I may need to use sections and put the body element inside the section element instead of the group name=”items|details” inside the body element. The <section> tag looks like a lot of overkill though, as I would have to repeat most of my report definition (I would define a composite). Is there any way to restart page numbering without using the full <section> feature?

 

NOTE: the warnings/output are the same with and without the appendToZenLastPage attributes (as expected because I am not using <section> tags.

 

I have the following:

<body appendIdToZenLastPage="true">

 

My main group inside the body element is defined as follows:

<group name="items|details" pagebreak="true">

 

And in my header, I have the following:

<th colspan="2" width="proportional-column-width(3)" style="text-align: right">

<item field='.' special="page-number-of-with-xpath" appendToZenLastPage="concat('id'),.)" />

</th>

 

 

Thanks!

Derek

Jonathan Levinson

unread,
May 3, 2013, 1:03:11 PM5/3/13
to intersys...@googlegroups.com

You ask if there is any way to start page-renumbering without using sections.

 

There are several features of ZEN Reports that are used to control “first”, “rest”, and “last” pages, restarting of page numbering, and sections.

 

These are associated with master-reference, section, and grouping.

 

Here is an article about grouping from the documentation.

 

Please let us know if you need more information.

 

Resetting the Page Count for Each Element of a Group

You may need to create a report that displays page numbers, and starts page numbering from 1 for each element of a group.

The following example is based on the report ZENApp.MyReport in the SAMPLES namespace. Given the ReportDefinition section as defined in ZENApp.MyReport, the following ReportDisplay creates a report that starts page numbering at 1 when the name of the sales representative changes, and determines the total page count of the report section for each sales person. The key steps are:

·          In the <report> element, set the attribute primaryGroup to the name of the group defined in the ReportDisplay that contains the elements you want to use to restart numbering. In this case, the group is “SalesRep”. See this line in the following code sample:

·         <report xmlns="http://www.intersystems.com/zen/report/display"

·             name='myReport' title='Sales Report' primaryGroup="SalesRep">

·          Use one of the "-with-xpath" values of the <item> attribute special to add page numbers to the report. These values tell the report that the page numbering is going to be controlled by the XPath value provided in the field attribute of this <item> element. This example uses "page-number-of-with-xpath", and the XPath value is “@name”, so page numbering starts at 1 when the value of “@name” changes. See this line in the following code sample:

·         <item field="@name" special="page-number-of-with-xpath" width="1in"/>

·          In the <body> element, set the attribute genLastPageIdOn to the XPath value that controls numbering. This is the same XPath expression used in the field attribute in the previous step. See this line in the following code sample:

·         <body genLastPageIdOn="@name">

·          In the <group> element whose name matches the group set as primaryGroup in the <report> element, set the attribute primaryGroup to “true”. This boolean value states that this is the ReportDisplay group that contains the elements that control numbering. See this line in the following code sample:

·         <group name="SalesRep" primaryGroup="true">

·         . . .

</group>

The following code sample provides the entire ReportDisplay section for a report that restarts page numbering for each sales representative:

<report xmlns="http://www.intersystems.com/zen/report/display"

    name='myReport' title='Sales Report' primaryGroup="SalesRep">

  <document marginBottom=".75in" marginLeft=".5in"

    marginRight=".5in" marginTop=".5in"

    height="11in" width="8.5in"/>

  <pagefooter>

    <line pattern="solid" thickness="1px" width="7.5in"/>

    <table orient="col" width="7.5in" layout="fixed">

      <item field="@name" width="6in"/>

      <item value="Page:" width=".5in"/>

      <item field="@name" special="page-number-of-with-xpath" width="1in"/>

    </table>

  </pagefooter>

  <body genLastPageIdOn="@name">

  <!-- MAIN REPORT GROUP -->

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

    <!-- SALES REP INFO -->

      <header>

        <table orient="row" width="3in" class='table2'>

          <item field="@name" width="1in">

            <caption value="Sales Rep:" style="width:2in"/></item>

          <item field="count">

            <caption value="Number of Sales:" /></item>

          <item field="subtotal" formatNumber='###,###,##0.00;(#)'>

            <caption value="Total Value of Sales:" /></item>

          <item field="avg" formatNumber='###,###,##0.000;(#)'>

            <caption value="Average Sale:" /></item>

        </table>

        <line pattern="empty" thickness="1px" width="7.5in"/>

      </header>

      <!-- TABLE OF SALES -->

      <table orient="col" group="record" width="6in" class="table4" altcolor="#DFDFFF">

        <item special="number" width=".45in" style="color: darkblue;">

          <caption value="#" /></item>

        <item field="@id" width=".7in" style="border:none;padding-right:4px">

          <caption value="Sale ID"/></item>

        <item field="date" width="1.5in" style="padding-left: 4px;">

          <caption value="Date"/></item>

        <item field="customer" width="2.65in">

          <caption value="Customer"/></item>

        <item caption="Amount" width=".7in" style="text-align:right;"

          field="@number" formatNumber='###,###,##0.00;(#)'>

          <caption value="Amount"/>

        <summary field="subtotal" style="font-weight:bold;text-align:right"

          formatNumber='###,###,##0.00;(#)'/></item>

      </table>

    </group>

  </body>

</report>

--
You received this message because you are subscribed to the Google Groups "InterSystems: Zen Community" group.
To post to this group, send email to InterSys...@googlegroups.com
To unsubscribe from this group, send email to InterSystems-Z...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/InterSystems-ZEN?hl=en
Zen Community Terms and Conditions: http://groups.google.com/group/InterSystems-ZEN/web/community-terms-and-conditions
---
You received this message because you are subscribed to the Google Groups "InterSystems: Zen Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-z...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages