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

Flowers and Databases.......is this a running total or a loop problem

Status
Not open for further replies.

JamesFlowers

Programmer
Mar 23, 2001
97
0
0
GB
Hi I have a problem with this as below

I have a DB with
PART_NO DESCRIPTION QUANTITY
P001 WHITE ROSES 5
P002 RED ROSES 8
P003 WHITE CARNATIONS 12
P004 YELLOW DAISYS 16

and I am looking for
P001 WHITE ROSES
P001 WHITE ROSES
P001 WHITE ROSES
P001 WHITE ROSES
P001 WHITE ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
etc..etc..
ie 5x white roses, and 8x redroses and 12xwhite carnations and 16x yellow daisys.

if anyone can help Many Thanks


James Flowers
 
Hi James,

You can probably solve this either way but ...

local stringvar s := "1234567890";
ReplicateString (s+chr(13)+chr(10),10)

This generates ten lines with 1234567890 in.
All you need to do is modify this accordingly to use the number from your count field.

Hth,
Geoff
 
Geoff,

Thats great if I want it to say
P001 WHITE ROSES 12345
P002 RED ROSES 12345678

but how do I translate that to going down a detail line to what I want

which is

P001 WHITE ROSES
P001 WHITE ROSES
P001 WHITE ROSES
P001 WHITE ROSES
P001 WHITE ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES
P002 RED ROSES

 
Hi James,

I assumed you would realise that you obviosly need to change s as well as the 10 !!

ie.
local stringvar s;
s := {table.Part_no} + space(10)+ {table.description};
ReplicateString (s+chr(13)+chr(10),{table.quantity})

Geoff

PS. You wil need to use a fixed font like Courier New to get the line up correct.
 
There is another technique that actually gives you multiple records, but it requires the ability to add a new table to the database.

This new table would have one numeric field, 100 records, with the values 1 - 100. You would link your QTY field to this table using the rarely used link option of "Less than or equal to". This forces the original record to duplicate as many times as the quantity number. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
HI,

The replicate string function works on its own in a formula by:
ReplicateString({table.Description } + chr(13), {table.Quantity})


As long as you check the 'Can Grow' box in the format editor, it should work.

Cara
 
Thanks fopr all your help.

intersting ways to do this but we have go with Kens (this actually gives us the multiple records we want to be able to put fields in)

We are printing labels so we have to set the report to new poage after each new grouping of flowers.

Many thanks once again

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top