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

Sub Reports

Status
Not open for further replies.

JRN30

Programmer
Oct 23, 2003
7
US
Ok I'm not sure how to respond to a previous thread, which was Filtering Data so I started a new thread. Any way, I am trying to create a Crystal sub report within a main report. I don't know how to pass the data from the main to the sub report. In the main report, I have a few parameters:
Start Date
End Date
Location
and i am hard coding it to look for certain part #'s. From this I need returned back the Invoice numbers that contain those part numbers within the selected date range.

How do I pass those Invoice numbers on to the sub report? When I went to link the reports, I choose to link on the Invoice # field and then it automatically created a parameter invoice #, which it then added to the record selection criteria in the sub report. This doesnt seem to work. Any suggestions on linking the 2 reports or what I am not doing or doing wrong?

Thanks!
 
Before deciding to use a subreport, you should understand why you are doing so, and at minimum, where your data is and how it's linked.

In general post the basics:

Crystal version
Database/connectivity used/can you create database objects?
Example data
Expected output

If you intend to describe a main report and a subreport, state some particulars:

Does the main report have any groups?
Where is the subreport within the main report?
What fields need to be linked to the main report, if any?

I would guess that you should link your date parameters to the appropriate date field in the subreport. Note that when you use a start and end date and link by a date field, you'll need to go into the Report->Selection Formulas->Record afterwards and change the EQUALS to >= and <= for the 2 dates.

Hope this helps, and please remember to provide environmental and technical information in your posts.

-k
 
OK, here is some background data:
We are using Unidata and connect through ODBC. We are on a old version of Seagate Info: 8.0.1.1

What I am trying to do is this:
Create a report, which lists Invoices and its entirety (all details of the invoice) from a selected list of part #'s. Now I need to see what is on the entire Invoice containing those part #'s. So I will need to see all the other part #'s and the detail on the Invoice. I did not know how to do this without creating a sub report.

In the main report, I am listing Invoice date and Invoice #. There are no groups. I have the following prompts:
Location - will need to run for different company locations
Start Date - Invoice Start Date
End Date - Invoice End Date
I have the part numbers hard coded in which to find the Invoice #'s that contain them.

Once I get the list of Invoice #'s, I need another report showing Invoice detail. This is what I created the sub report on giving me Invoice detail such as part #'s, description, amount and cost at the item level. I have grouped this report on Invoice #.

I tried to link the two reports on the start date and end date (followed the correct way to do this). This gives me all Invoices for the Start and End Date. I only need the invoice #'s that get returned from the main report. That is what I need the detail information on. I think I need to link on Invoice #'s. I tried this and only get 1 Invoice # retutned to me in the sub report instead of all the invoices on the list.

Here is an example:

Main Report (data that came back):
Invoice Date Invoice #
20050105 123
20050105 220
20050105 301

These are the Invoice #'s I need detail on from the sub report, which would look like this:

Invoice Date Invoice # Part # Desc. Amount Cost
20050105 301 abc test 5.00 3.00
20050105 301 def test2 2.00 1.00

I only got back detail information on 1 invoice instead of the entire list from the main report.

This is my first sub report, so I'm not sure exactly how to get this data and how to set up the link.

Thanks, hope that was more descriptive.
 
Excuse me if this is a stupid question but do you really need a sub-report?

Is the data you are trying to sub-report on not in the same table as the invoice date/ invoice number? Or at least in another table you can link to (say by primary key 'Invoice Number'). In which case you could keep your current parameters (ie Location/ start date/ end date) but just add the Part no/ desc/ amt/ cost as fields in the main report. Group by Invoice number.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top