AggregateFunction Max on a Date field?

Posts   
 
    
w3stfa11
User
Posts: 13
Joined: 01-Jul-2010
# Posted on: 23-Sep-2010 19:26:51   

I have this code, but it doesn't seem to be working.

AccountCollection accts = new AccountCollection();
                PredicateExpression filter = new PredicateExpression();
                filter.Add(AccountFields.ClientId == clientId);
                var date = (DateTime)accts.GetScalar(AccountFieldIndex.SetupDate, null, AggregateFunction.Max, filter);

It's always returning the value of first date field.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 23-Sep-2010 20:01:58   

Can you post the generated SQL please ?

Matt

w3stfa11
User
Posts: 13
Joined: 01-Jul-2010
# Posted on: 23-Sep-2010 21:30:44   

I apologize, it's a mistake on my end. The code is working fine.

Thanks

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 23-Sep-2010 21:50:44   

simple_smile

Matt