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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you print each details line multiple times? 3

Status
Not open for further replies.

uczmeg

MIS
Mar 7, 2001
61
GB
Hi,

We use crystal (8.5) successfully to create invoice reports. However we have a new customer that demands their reports in a different way.

So instead of the following for each detail line:

Item A Qty 3 Price £300
Item B Qty 2 Price £100

They want:

Item A Qty 1 Price £100
Item A Qty 1 Price £100
Item A Qty 1 Price £100
Item B Qty 1 Price £50
Item B Qty 1 Price £50

They want the details line repeated for each quantity. So 3 items bought shows 3 lines, 4 items shows 4 lines etc.

Is it possible to do this in crystal? I'd rather not create external tables as I'm already pulling together a few difficult datasources....

Cheers
Marc
 
Depending on the maximum quantity you could do this by creating multiple details subsections and suppressing the ones not needed, but you would have to know the limit of potential quantities to know how many to make.

A simpler technique requires creating an "inflation table" that is a list of quantities from 1 to 999 and linking this to the quantity field using a "Less than or equal to" join. This causes a record with qty of 5 to appear 5 times.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- TEK2(AT)kenhamady.com
 
You might want to create a formula:

Find the quantity value
then have a piece of text saying "Qty 1 Price £" + Price/Quantity.

Then put it in some sort of loop to repeat this piece of text (with a character return at the end) from 1 to quantity.

This of course will just give you one record, so if you have any summaries relying on counts you'll need to look into changing them.
 
I think a Do...Until loop should work, keep increasing an index count by one inside the loop until it is equal to your value of Quantity.
 
You could add in as many sub Detail sections as you think the maximum Qty of an item would be, then add the same fields into each section. Then, you'd have to enter a suppression formula for each subsection.

For example:
[tt]
Section Suppression Formula
--------- ----------------------
[DetailsA] no suppression formula
[DetailsB] {Table.Qty} < 2
[DetailsC] {Table.Qty} < 3
[/tt]
You'd also want to create a formula for displaying the quantity as '1' instead of the actual quantity.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top