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!

translating a Quantity field into multiple detail lines 1

Status
Not open for further replies.

zemp

Programmer
Jan 27, 2002
3,301
0
0
CA
here is the Issue! I have a report and with in that report is a subreport, with in that subreport I have 3 main fields
Item Number, Item Description and Quantity. if the quantity is 6 then I need the Item Number and Item description to print six times.

c123 custom Item


c123 custom Item


c123 custom Item

etc....

any suggestions as to how I could produce this?

Thanks and Good Luck!

zemp
 
All depends on where you are doing the printing.

If in the main report...then pass the values back from the subreport with shared variables....create 6 sections for display....conditionally suppress 5 of them if there are Less than six items.

However I am sure that you have not given the whole story here

Jim Broadbent
 
zemp, try this:

Create a table which contains a single field with values in rows as follows:

1
2
2
3
3
3
4
4
4
4
etc. (i.e. you'll have one 1, two 2's, three 3's ... six 6's ...)

Create an equal join between this field and the QUANTITY field of your table, and Crystal will produce the corresponding number of duplicated lines.
 
You might also use the replicatestring function to replicate {table.field}+chr(13) the {sharedvariable} number of times you need it. Then turn on the Can Grow formatting option.

So you create 2 formulas and you're done.

Should work providing you don't hit your version of Crystal's limitations for strings....

-k
 
Rather, use 1 formula, more like:

replicatestring( {table.field1}+chr(9)+{table.field2}+chr(13),{@qty})

Not at a Crystal box so I can't test.

-k
 
this is close to what I need but here is the fields in the report

table.field1 + table.field2 * (Table.qty)if this is 6

=table.field1 + table.field2

=table.field1 + table.field2

=table.field1 + table.field2

=table.field1 + table.field2

=table.field1 + table.field2

=table.field1 + table.field2

in order for the labels to print consecutively

Thanks and Good Luck!

zemp
 
zemp,

If you build a little table - in SQL, in Access, anything - as I laid out above, link it to the tables in your subreport and then place the field of that new table on your subreport (you can suppress it so it can't be seen), you will achieve exactly what you describe. I do it all the time for address labels.
 
You did not define this as a label report...then follow my first advice and save your data to Shared variables that are Strings first initialized to null

Then you just fill the labels with the data...You would fill an array with the information and dedicate each element to a different label

Jim Broadbent
 
CarolineS, thanks that worked great. You get a star.

Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top