简体   繁体   中英

Print one row in multiples rows, depending on a value

thanks on advance for your help.

I want to be able to print one row into multiples rows to print labels, example below.

ItemID Descripcion Qty
052 Orange Juice 300

I want to print 3 lines of the same row, and the numbers of row will be calculated (in this case) by 100, for example, so I want to print this:

ItemID Descripcion Qty
052 Orange Juice 100
052 Orange Juice 100
052 Orange Juice 100

But in the order table, I have one line of row.

Thanks for any help, I'm not sure if this is supported.

Two ways to do that, Either use Push Method of Crystal Reports ie Fill the DataSet object (in code) and pass into Crystal Report as DataSource or make Stored Procedure and push the data in temp table as shown here

declare @i int;
declare @copies int;
select part_code, description
into #temp
from parts

select * into #temp2 from #temp;

set @i = 1;
while @i < {@copies}
begin
  insert into #temp2 select * from #temp;
  set @i = @i + 1;
end;

select * from #temp2;

Option 1. if the max quantity is not too large, you can create multiple sections (Details a, Details b, Details c, ...) and use a dynamic suppress condition to hide the sections beyond the quantity value.

Option 2. Create a "REPEATER" table with a single column (How_Many) and rows for 1 | 2 | 3 | 4 | 5 | 6 | ...

Now, in your report, add the REPEATER Table and add a Record Selection condition of

{QTY}/100 >= {Repeater.How_Many}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM