views:

128

answers:

1

Use Case:

Would like to use IReport to Label item sold in my shop. The thing with labels is that for each product there can be multiple items that need to be labeled. So let say product CarToy is 1 record in database (field name, description, price).

Question:

To label CarToy item in my shop I will have to print a report containing the 3 field on a sticker paper.

Doing it the normal way will result to a report containing 1 sticker.

If there is 5 item in my shop. Then I would like to print 5 sticker in the report.

Basically I would like to pass a query result containing records (row of data) to IReport and tell it how many time to print/display each record/row. Assuming that I can pass the required parameter (for instance repeat X time) from my program.

Any idea how this can be done?

Unwanted Solution

Possibly this can be solve at software data layer. For instance I can pass a result set that contains each row already duplicated/repeat X times. Example: Query the CarToy (which result to 1 record). Manually create a result set containing 5 CarToy records and pass this to Jasper Report.

However I would like to give a solution to end user in a form of JasperReport report xml that can be customized on their side. So above is not a solution that I'm looking for.

Better yet if I can do everything using IReport withou any requirement to modify software. For this to be done perhaps there is some scripting ability or I can create a simple GUI in IReport that accept the (repeat X time) parameter.

TIA Haris

A: 

An idea might be to select the same row multiple times in SQL and then display that in your report.

You could pass the amount of times you would like to print a sticker to your select statements as a parameter in jasper report.

Have a look at this stackoverflow question about selecting the same row multiple times.

iReport also allows you to set the number columns you want in your report so if you want to save some paper print them 3 by 3 or whatever fits best.

You can set it in the properties window of your main reports under the Columns section.

Gordon