Skip to Content

Generate new pages based on variable in Crystal Reports

Nov 21, 2017 at 03:16 PM


avatar image


I'm trying to write my own replacement for our ERP systems "print box tag". I have created a design that amoung other things shows me the number of articles in a box. Now, based on how many pieces are in a batch I want to print the correct number of "box tags". Say I have a production batch of 500 and each box contains 50 pieces, I want Crystal Reports to generate 10 "box tags". If the production run ends up being 480 pieces, I want Crystal Reports to generate 9 "box tags" that says 50 pcs and 1 "box tag" that says 30 pcs. I can easily calculate how many "box tags" should be generated but how do I tell Crystal Reports to produce that number of pages?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Ido Millet Nov 21, 2017 at 06:05 PM

Assuming you already calculated the desired {@quantity} of labels,

Create a "REPEATER" table with a single column (How_Many) that looks like this:


Now, in your report, add the Repeater Table and add a record selection condition of:
{@quantity} >= Repeater.How_Many
This would cause each order to be duplicated as many times as the value of {Order.quantity}.

If you need to print "N of M" modify the repeater table to look like this:
1 1
2 1
2 2
3 1
3 2
3 3

And change the selection criterion to
{@quantity} = Repeater.How_Many

If you are not allowed to create a REPEATER table, there are alternative solutions:
1. Multiple detail sections (Da, Db, ...) with suppress conditions.
- or -
2. 3rd-party tool (at least one such tool can automatically print the desired number of copies based on a Crystal field or formula).

- Ido

10 |10000 characters needed characters left characters exceeded
Henrik Jäger Nov 23, 2017 at 08:36 AM

Hi Ido,

thanks for your reply. Unfortunatly you guessed right, I'm not allowed to add tables to our db, it is read only. Also, the problem is that multiple variables are passed along from the ERP system that are used to calculate the number of box tags, it is not done in the SQL Query.

Is it possible to create a main report which recieves all parameters and a sub report which is just the layout and then use the information provided in the main report to itterate including the sub-reports x number of times?


10 |10000 characters needed characters left characters exceeded