Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Grouping is confusing

  1. #1
    Join Date
    Jul 2003
    Posts
    6

    Default Grouping is confusing

    Hi,

    I am trying to make a simple report from a tablemodel that contains invoices(invoice#,date, client,total).

    I can display the data fine with the item band and a page header. But now that I want page numbers and totals at the end of my report, the "groups" concept is really confusing.

    I have looked at the jfreereportdemo and the jfreereport pdf documentation.

    All I want is:
    • one group with column titles on each page

    • the page number on each page

    • and column totals at the end of the report.


    Please help. Thanks in advance.

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Hi,

    our grouping is based on the same principles as the grouping in all relational databases; it may not be the best, but it is all that we have

    First, I guess you want to group your report by the "invoice#" column (that means that your tablemodel must be sorted).

    Pagenumbers should be printed in the page header or -footer, the demos should show you how to do that (report2.xml contains the pagenumbers in the page footer).

    The group headers can be repeated on every new page (by setting the repeat-attribute to true). This way, the group header is printed once when the group started and is also printed on the top of every page (until the group is finished).

    I guess you invoice will contain some more columns (like article number, article name, price, quantity etc.) This way, you have to add a second group to your report. This group will contain the fields "invoice#" and a dummy field (which can be any constant field (or just call it dummy, then it returns always 'null')).

    This way, we can add a second group header and footer to the report (this one will be repeated later and contains the column titles).

    So the structure of your report looks like this now:

    <report>
    <groups>
    <group name="invoice">
    <fields>
    <field>invoice#</field>
    </fields>
    <group-header>
    .. add your customer address and everything above the table with the articles here
    </group-header>
    <group-footer>
    ... finish the invoice
    </group-footer>
    </group>

    <group name="article-table">
    <fields>
    <field>invoice#</field>
    <field>dummy</field>
    </fields>
    <group-header repeat="true">
    .. add your customer address and everything above the table with the articles here
    </group-header>
    <group-footer>
    ... finish the invoice
    </group-footer>
    </group>
    </groups>

    <page-footer>
    ... your page x of y field ...
    </page-footer>

    <itemband>
    .. the rows of your article table ...
    </itemband>
    </report>

    The column totals can be computed using functions (again, report2 or report3 contains examples).

    Report3 contains a complete invoice (but without the repeating second header) so you can see how the tablemodel should be defined for that purpose and how to form groups for invoices.

    The documentation is mainly outdated, so be carefull with that. The things described there may or may not work anymore.

    Have more fun,
    said Thomas

  3. #3
    Join Date
    Jul 2003
    Posts
    6

    Default Thanks!

    Thanks Taqua,

    I got my report the way I wanted using a dummy column in the table model and using that as my group. I also put the page number in the group header so it works now.

    Now I am onto more difficult reports, wish me luck!

    Thanks for all the help and keep up the good work.

    Jeremy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.