Getting number of records

Posts   
 
    
bentos
User
Posts: 146
Joined: 12-Jul-2006
# Posted on: 15-Aug-2006 19:29:21   

Hello all,

Sorry, new user alert!

Could someone tell me how to do this using the best possible performance, I'm simply reusing the same view with different filters to count the number of records returned for reporting purposes, this is just one of the filters

                  predcancel.Add(FeMortgagelistjoinFields.Status == 778) ;

mortgagelistcount.Fill(0, null, true, predcancel); Int32 cancel = mortgagelistcount.GetDbCount();

For a start, I really do not need all the rows returning, just the count and this seems to be returning all records anyway despite the benefit filter

Thank you for your help,

Matthew

JimHugh
User
Posts: 191
Joined: 16-Nov-2005
# Posted on: 15-Aug-2006 20:14:34   

Check the docs for the GetDBCount function. You need to use one of the overloads.


OrderCollection orders = new OrderCollection();
IPredicateExpression filter = new PredicateExpression();
filter.Add(CustomerFields.Country == "France");
IRelationCollection relations = new RelationCollection();
relations.Add(OrderEntity.Relations.CustomerEntityUsingCustomerId);
int amount = orders.GetDbCount(filter, relations);

bentos
User
Posts: 146
Joined: 12-Jul-2006
# Posted on: 16-Aug-2006 17:26:18   

Thank you for your help, sorted know :-)