supplying different business objects as data to crystal reports

G

giddy

hi,

I posted here earlier with a great reply:
http://www.microsoft.com/communitie...6d7673-0e25-417d-849b-c4b270c76044&sloc=en-us

Something like this works nicely:
List<Person> ps = new List<Person>();
ps.Add(new Person("Gideon",15));
CrystalReport11.SetDataSource(ps);
crystalReportViewer1.ReportSource = CrystalReport11;

After adding this class to the database expert I can link Persons properties
to the report.

Now what if I have
class AccountLine{
Description
Amount
Date
}

I make a crsytal report the same way as I did above it works fine, I can
make a report with list of payments .

NOW, I need to add a total on the *bottom* of the whole list, so if the list
of payments if four pages long, the total should be at the end of the fourth
page, so I made:
class Total{
Amount
}

But if I add it to the database expert it doesn't work at all, even the
AccountLine data doesn't show up.

Is there no decent way of making fields in the report and specifying the
data that goes in there.

I hope my quesition is clear.

Thanks so much

Gideon
 
S

sloan

Unforunately, one work around I've seen is

Create a strong dataset.
Loop over your custom business objects / collection and populate rows in the
strong dataset.
Add your aggregate data to a different table in the strong dataset.
Use that as the CR datasource.
(Oh yeah, create your report against the XSD of the strong dataset)

Yeah, that sucks.

ActiveReports has a much better implementation.....it allows binding to
IList(s).
 
G

giddy

sloan said:
Unforunately, one work around I've seen is

Create a strong dataset.
Loop over your custom business objects / collection and populate rows in the
strong dataset.
Add your aggregate data to a different table in the strong dataset.
Use that as the CR datasource.
(Oh yeah, create your report against the XSD of the strong dataset)

Yeah, that sucks.
Thanks!



ActiveReports has a much better implementation.....it allows binding to
IList(s).
(Was more happy about this answer)
Active reports huh? Think its better when it comes to feeding business
objects? I mean, can I just reference business objects or better yet create
place holders and fill them up on my own?
The product does look good, but does it have some muck ups like CR?

(Should have posted a thread here asking for CR alternatives)

Thanks so much

Gideon
 
S

sloan

I can only add this:

I hate Crystal Reports.

I like Active Reports.



//Think its better when it comes to feeding business
Yes. It was better 4 years ago, and has only gotten better.

The dll deployment is pretty easy.

The last version I used, you had to do a

ActiveReport.SetLicenseKey "ABC123ABC123ABC123ABC123ABC123ABC123" ; << Where
this was a key given to you(your company).
That was the only snapfu with them at all.


Crystal Reports would be alot better if you could turn OFF the "Pull" model.
Too much hacking with that model.

The PUSH model is better with CR, and I can live with it when I have to.

But ActiveReports are much better.
 
G

giddy

I can only add this:

I hate Crystal Reports.

I like Active Reports.

I would have to agree, active report has a MUCH better model. Although, I
didn't find any docs on their model and its sad they didn't just add XML
comments, would be easier to figure things out. Also, v3.0, it seems has no
external files, the whole report is a class.

But! Alas! I can't possibly afford it! The App I'm building costs a fraction
of Active reports price tag!


I guess I'll have to stick to CR! Your dataset solution worked nicely.
Sadly, CR doesn't even have a way a printing a table(grid with borders).

Thanks so much

Gideon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top