Crystal and CSLA lists

Crystal and CSLA lists

Old forum URL: forums.lhotka.net/forums/t/703.aspx


Michael Hildner posted on Sunday, July 23, 2006

Hi,

I'm trying to figure out how to use Crystal Reports with CSLA list objects. Say I have a CustomerReadOnlyRootList that contains a collection of CustomerReadOnlyChild objects.

I can't use the list object for designing the report, as it doesn't contain my Customer properties. I can use the child object. What I'm trying to figure out is how to get this all wired up at runtime, so the report will show the results of whatever Get method gets called on the root list object.

Any help appreciated,

Mike

Michael Hildner replied on Sunday, July 23, 2006

Funny how sometimes as soon as you ask a question, or somebody looks over your shoulder, you tend to look at things differently.

Here's some code that seems to work just fine:

ReportForm rf = new ReportForm();

CrystalReport1 report = new CrystalReport1();

rf.crystalReportViewer1.ReportSource = report;

AddressReadOnlyRootList addressList = AddressReadOnlyRootList.GetAddressReadOnlyRootList();

report.SetDataSource(addressList);

rf.Show();

John R replied on Wednesday, October 04, 2006

If you're using a BindingSource object for your RootList, you can also pass the binding source object instead and avoid a database hit:

report.SetDataSource(addressListBindingSource);

Michael Hildner replied on Wednesday, October 04, 2006

That's cool, I'll give it a try.

Thanks,

Mike

Copyright (c) Marimer LLC