Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicating Records based on a Quantity Field

Formula Help

Duplicating Records based on a Quantity Field

by  IdoMillet  Posted    (Edited  )
Problem:
A typical situation is where a number of label copies must be printed for each order according to the {quantity} field in each order record.

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

How_Many
1
2
3
4
5
6
etc.

Now, in your report, add the Repeater Table and add a join
condition of:
-----------------------------------
Order.quantity >= Repeater.How_Many
-----------------------------------

If the ">=" join option is not available, remove the join to the REPEATER table and create this condition in the Record Selection condition:
--------------------------------
{Order.quantity} >= {Repeater.How_Many}
--------------------------------

This would cause each order to be duplicated as many times as the value of {Order.quantity}.

If you are restricted to using an equal join, you can also modify the repeater table to include N records for each quantity N:
1
2
2
3
3
3
...

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:
N M
1 1
2 1
2 2
3 1
3 2
3 3
...

Cheers,
- Ido

Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
www.MilletSoftware.com
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top