Search code examples
sqlpostgresqljasper-reports

How to set number of copies for every page by value in Ireport?


Is it possible to set number of copies for page?

For example:

SELECT NAME, TYPE, QUANTITY FROM INFORMATIONS

SQL result:

Tom | house | 2

Mark| cars | 3

One page is for Tom and second page is for Mark.

Can i write SQL that will output me that many results as i want. (some for loop?)

I want to see in preview 2 pages for Tom(copies) and 3 pages for Mark. (5 pages to print)

Please, if you can past me sample code or pictures how to do it.


Solution

  • If you want to generate rows based on the quantity, you can do:

    select i.*, generate_series(1, i.quantity) as n
    from informations i;
    

    This seems to be what you asking.