Aggregates - how?

Posts   
 
    
Gareth
User
Posts: 24
Joined: 09-Apr-2004
# Posted on: 24-Apr-2004 00:22:30   

How is every do their aggregates, especially COUNT?

I don't really want to use SPs, whats the best solution until Frans get round to adding these functions.

Cheers

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 24-Apr-2004 09:14:56   

With a proc, I'm afraid. (I know, not ideal...).

Frans Bouma | Lead developer LLBLGen Pro
Gareth
User
Posts: 24
Joined: 09-Apr-2004
# Posted on: 24-Apr-2004 13:01:10   

I had a good play with this last night and loaded the TypedList or View into a DataTable and then using the compute method carried out my aggregates that way.

Do you think a proc would be more efficient?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 24-Apr-2004 13:28:01   

The typed view and typed list classes are already datatables, so you can just create a dataview using these.

If the typed view/typed list objects contain lots of data, it's not that efficient of course, but a few rows don't hurt much.

Frans Bouma | Lead developer LLBLGen Pro
Gareth
User
Posts: 24
Joined: 09-Apr-2004
# Posted on: 24-Apr-2004 16:34:48   

Like this -

 surveyStats.DataSet.Tables[0].Compute("COUNT(Surhowmany)","").ToString();

I'll have to run some tests, but if a stored procedure is the way forward for now then so be it. The view will hold 500 to 5000 records, so really not to many, but there are a lot of stats to come off.