I've got a barcode report which is using a sequence (Oracle backend) to generate my barcode numbers.
This is in my query:
SELECT to_char(PALLET_ID_NO_SEQ.nextval) FROM dual
I placed this field in designer window which will display the barcode value.
I have an image with expression:
new com.pepkorit.BarbecueRotateRenderer(
net.sourceforge.barbecue.BarcodeFactory.createCode128C(
$F{TO_CHAR(PALLET_ID_NO_SEQ.NEXTVAL)}), false, true, 1, 50, 190, 50)
The above is the barcode using the sequence value.
I want to be able to say to print/generate 100 or more reports. At this moment I'm able to generate only one report at a time.
So my first guess is to get a parameter that prompts the user a value and that value will indicate how many barcodes to be printed and each with an individual number.
I'm not sure that my ideas about solving this problem are right and how to do it.
Can someone please help?
One possible way :
1) Create a bean :
2) Populate 100 of such beans with data ( image of your barcode )
3) Create a jasper report like this :
4) Set type of image field ( in the report ) to java.awt.Image
5) Create the report as a desktop application ( in your case, use other ways, if needed )
It can be easily done with small modifying of your query without programming in several ways.
Solution 1. Using single report with Barcode component in Detail band
You can use single report's template for generating several barcodes in one report.
In this case the queryString expression (works for Oracle DB) will be like this:
- it is generates a value from the sequence as many times as you need. The $P{quantity} parameter determines the number of rows (barcodes) to be generated.
The working rjxml file:
The result will be ($P{quantity} == 5):
In your case the queryString expression will be like this:
and the expression of Barcode component will be:
Solution 2. Using Group Header band
You can use the same queryString expression as in the first solution. The group on rownum field will help us to generate single report with many barcodes belonging to its own group (one group - one barcode). The Barcode component should be placed to the Group Header band.
Using the isStartNewPage property we can manage to generate group on new page or not.
The rjxml file:
In case isStartNewPage="false" for group rownumGroup the result will be ($P{quantity}== 7):
In case isStartNewPage="true" for group rownumGroup the result will be ($P{quantity} == 5):
Solution 3. Using subreport
We can add Subreport component to the Detail band (see first solution) or Group Header (see second solution) band. In this case you can add to the subreport not only the Barcode component, but everything you want.