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

Subreport Shared variables

Status
Not open for further replies.

fredp1

MIS
Jul 23, 2002
269
AU
I need to produce a report which shows the invoice details as well as the serials that was shipped.
The invoice details is simply 1 row per invoice number.
The problem is when displaying the serial numbers, as they are a one to many serials can be shipped for each invoice.

I've tried used a linked subreport to grab the serials, but when exporting the report to excel, the serials are not aligned correctly.
I was thinking that if I used a shared variable, I can pass the value(s) back to the main report and have it nicely formated for exporting.

I've tried to used a subreport with a shared variable, but it will only show the last (one) serial, not all the serial rows associated with the invoice.
The database is sql server.
For simplicity, the 2 tables are Invoice and InvoiceSerial
The Invoice Table has InvoiceNumber and Amount
The InvoiceSerial Table has InvoiceNumber and Serial

The main report:
The subreport is in "detail a" section.
The report has the invoice details in the "detail b" section.
The shared string variable is in "detail b" section.

The subreport:
The serial number field is in the "detail a" section
The shared variable is in the "detail" section.

e.g. expected output
Invoice Serial Amount
0001 ABC100 $100
ABC101
ABC102
0002 ABC200 $200
0003 ABC300 $140
ABC301
0004 ABC400 $120

Can someone advise what I need to do to get this to work?
Thanks
Fred

Cheers
Fred
 
Might have missed something in this but I think you are making this more complex than it needs to be.

Your expected output isn't entirely clear but I would have thought you could achieve what you need if you simply placed the Invoice, Serial and Amount fields in the Details section. Then sort by Invoice, format the Invoice field to Suppress if Duplicated and suppress the amount if the invoice number equals the previous invoice number.

If this doesn't give you want you want, please provide more iformation.

Cheers
Pete
 
Hi Pete,

Thanks for the reply. The formatting of the post made it unclear.

After a good night sleep, I agree it was made more complicated than it needed to be.
In this instance, I just kept the report similar to what you suggested. Thanks.

In the example I provided, I was trying to get all the serials into a array variable or similar.
I'm curious though, when using a subreport, how can you pass a row of records into a array variable?

TIA



Cheers
Fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top