iReport multiple copies of same report with different label

前端 未结 1 1953
野的像风
野的像风 2020-12-12 06:48

I am using iReport 4.1.3. I have created invoice report and I want to have 3 copies of same invoice report. The first invoice should have label as \"ORIGINAL\", sec

相关标签:
1条回答
  • 2020-12-12 07:24

    If you would like to show all three copies every time you open the report, here is a creative if not elegant solution.

    Add a cross join to the FROM clause of your query returning the three different copies. In MySQL it looks like this:

    CROSS JOIN
    (
    Select 'ORIGINAL' as copy, 1 as sequence
    UNION
    SELECT 'DUPLICATE' as copy, 2 as sequence
    UNION
    SELECT 'TRIPLICATE' as copy, 3 as sequence
    ) x
    

    Then add the "copy" field to your select statement. This will cause your query to return 3 records for each record it was previously returning. One record with "ORIGINAL" in the copy field, one with "DUPLICATE" and one with "TRIPLICATE". Add "sequence" to your ORDER BY clause.

    Then in the report, group by the "copy" field. Force a new page for each group and you should be all set. Any variables you are totaling at the report level you will need to change to the group level ("copy" group). And if you have any controls in the Summary section, move them to the new group footer section. Also create a text field to display the "copy" field in the page or group header.

    It's not necessarily pretty, but it should work.

    0 讨论(0)
提交回复
热议问题