Crystal Report (new to it) - why doesn't subreport get populated?

Camillia
Camillia used Ask the Experts™
on
I've spent two days on this and no one at work knows Crystal Reports. I'm new at the job and to CR. I've used SSRS in the past.

I hope someone can help me with this. I'll go step by step.

1. I have a main report and some some reports. The datasource for them is datatables. I see the datatables being populated but the subreports aren't. I changed a datasource for one of them and I wonder if that caused the issue.

2. This is the Main Report and has "Transactions" subreport
r1.png
3. I changed the datasource to a new datatable for subreport Transactions
r2.png
4. I see the Database Fields.
r3.png
5. This is how I updated the Datasource for the subreport. The one marked X is the old one and I updated it to the new one..marked with circle.
r4.png
6. I see 2 datasources but I'm using the first one
r5.png
7. I checked the subreport and I see this. I don't think I need that checkbox to link to the main report. I tried it with and without the checkbox.
r6.png
8. I see the data when I step thru the code

r7.png
9. I don't see the data on the report
r9.png
I've tried lots of things; Populated the old datatable, copied the new datatable to old one, set the datasource in the code, cleared the datasource in code, assigned it again. I also added a test subreport and that didn't get populated either.

Is my option to delete the subreport and readd it? doubt that would work because I added a test subreport (as I said above) but that didn't get populated either.

Some code that the ex developer wrote:

rp = new WindowsReportingApplication.Account_History.CrystalReport_AccountHistory();

rp.ResourceName = "CrystalReport_AccountHistory.rpt";
  rp.SetDataSource(ds);
..
ReportDocument sr1 = rp.OpenSubreport("Transactions");

//*** I tried these but didn't work
  //rp.Subreports["Transactions"].DataSourceConnections.Clear(); //camilla try
          //  ReportDocument sr1 = rp.OpenSubreport("Transactions");
            //sr1.DataSourceConnections.Clear(); //camilla try
            //sr1.SetDataSource(ds.Tables["ST_CCL_DC_AccountHistory_List"]); //camilla try

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Looks like I have to delete and recreate the report.
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
WHat device is the main report using in that record.  It has to match the device in the subreport data otherwise there won't be any subreport data.

Try deleting the subreport link and see if you get data.

mlmcc
>>Try deleting the subreport link and see if you get data.

You mean delete the entire subreport and rebuild?

>>WHat device is the main report using in that record.  It has to match the device in the subreport data otherwise there won't be any subreport data.

Main and Subreport are not linked together. Subreports  are built using datatables.
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

I know what you mean. Let me try it.
Yes, that was it!
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
THe sub was linked to the main so either there is no data for that main report record or the link was wrong

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial