Generate same data with multiple copies in single PDF

Hello All,

            I am using ireport designer 5.1.0 , accordong to the requirement i need to generate a report where it will contain no of items imported in a warehouse, this i can do easily, but i m banging my head over creating same pdf with 3 times merged into a same pdf. So the inspection guy can take the print out keep one copy to himself and share the rest with other offical purpose.

For example: If items ITEM001, ITEM002, ITEM003 are recorded. I need to generate like

Copy - 1

             Items          SL No

             ======      =======

             ITEM001          1

             ITEM002          2

             ITEM003          3

Copy - 2

             Items          SL No

             ======      =======

             ITEM001          1

             ITEM002          2

             ITEM003          3

Copy - 3

             Items          SL No

             ======      =======

             ITEM001          1

             ITEM002          2

             ITEM003          3

             I have followed the this post -  http://stackoverflow.com/questions/10912710/ireport-multiple-copies-of-same-report-with-different-label

             so far I am able to create a 3 sets of data, but how to make sure the header details should be repeated only for each Sets of data (ie. for Copy1, Copy2 ,Copy3) & how can i calculate the sl no in each set.

             Kindly help me.

Regards,,

  Amit

joshi.nie's picture
Joined: Sep 25 2013 - 9:44pm
Last seen: 9 years 2 days ago

1 Answer:

Hi, From what you are saying I understand you are producing a data set that has the 3 records multiplied by 3, so you end up with a data set that has 9 records in it. That is good. The question is: how do you produce this dataset. Do you have an SQL query? If so, why don't you add a new column to your SQL query in which you specify the group number. You can exploit the extra column in the report by using it as a report field in the expression of a report group. Having a group break every time that column changes its value allows you to put the CopyN and the SL No fields in the group header section. I hope this helps. Teodor
teodord's picture
47352
Joined: Jun 30 2006 - 9:00am
Last seen: 20 hours 7 min ago

@teodord, thanks for reply, as u have suggested i do have an extra column which would speciify the group no for each record. Foll. is the sql query.

=====================================================================

SELECT
copy, item_master.`id` AS item_master_id, sequence

FROM
`item_master` item_master
CROSS JOIN
(
Select 'COPY1' as copy, 1 as sequence
UNION
SELECT 'COPY2' as copy, 2 as sequence
UNION
SELECT 'COPY3' as copy, 3 as sequence
) x
GROUP By COPY, item_master.`id`
Order By COPY

=====================================================================

"You can exploit the extra column in the report by using it as a report field in the expression of a report group. Having a group break every time that column changes its value allows you to put the CopyN and the SL No fields in the group header section."

I didn't get the above part in your post. Since i am new to this ireport designer. If u can provide any possible resources. I might be of great help.

Thanks,
Amit

joshi.nie - 9 years 8 months ago
Feedback
randomness