Multi pages report

edited November 2010 in FastReport 4.0
Hello!
I need to make a report with 3 pages, 3 different bill for example, per each user (more than 10000 users). All the data to get the user and bills information are in tables or query. It should be in this order:
(User1-Page1)-(User1-Page2)-(User1-Page3)-(User2-Page1)-(User2-Page2)-(User2-Page3).....
I tryed a lot of convinations of reports, subreports, but nothing works. Can somebody help me?

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited 1:15AM
    OnBeforePrint of each page:

    page1.visible := (UserVariable = 'user1') or (UserVariable = 'user2')

    Check how to pass values to variables in the manual or in the other threads of the forum here
  • edited November 2010
    But i'm talking about maybe 100000 users, not only 2. All the information comes from a table or a query.
  • edited 1:15AM
    Mememe wrote: »
    But i'm talking about maybe 100000 users, not only 2. All the information comes from a table or a query.
    Just cycle through the dataset(s) in the correct sequence.
    The easiets may be to have a query for the users and another one for the data on the 3 pages. However, this may be quite slow.

    What is the real problem here? That it does not work at all, or that it takes too long?
  • edited 1:15AM
    The problem is that in this way, I'll have for each user the page one, and after for each user the page 2, and so on:
    (User1-Page1) (User2-Page1) (User3-Page1) (User4-Page1)....(User1-Page2) (User2-Page2).... <--This's not what i need
    (User1-Page1) (User1-Page2) (User1-Page3) (User2-Page1)(User2-Page2) (User2-Page3) (User3-Page1) .... <--That is
    I need to have the information grouped by customer, composed by 3 diferents pages.
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 1:15AM
    Still, what you need is to control if the page is printed or not, and this is how it's done:

    Page1.OnBeforePrint(sender);
    begin
    page1.visible := yourcondition. This can be a function call, back to your Delphi code or FRscript. Read the manual for this
    end;
  • edited 1:15AM
    Mememe wrote: »
    The problem is that in this way, I'll have for each user the page one, and after for each user the page 2, and so on:
    (User1-Page1) (User2-Page1) (User3-Page1) (User4-Page1)....(User1-Page2) (User2-Page2).... <--This's not what i need
    (User1-Page1) (User1-Page2) (User1-Page3) (User2-Page1)(User2-Page2) (User2-Page3) (User3-Page1) .... <--That is
    I need to have the information grouped by customer, composed by 3 diferents pages.
    Does this mean you have a single report with the 3 pages?
    My methods would use 4 queries, an outer one for the user, and 3 nested inner ones for the 3 pages, and there would be 3 reports.

    while not customer_query.EOF do
    begin
    report_query_page1;
    print_page1;
    report_query_page2;
    print_page2;
    report_query_page3;
    print_page3;
    customer_query.next;
    end;

    Never having used a FR report with multiple pages (just subreports) there may be other ways of printing.

    This method is not the most efficient and may be slow. 3 queries have to be run and 3 report have to be rendered for each customer. However, depending on the database used for storage some careful indexing might improve the data access time.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.