Need SortExpression that matches the order by query in my example.

Posts   
 
    
Posts: 22
Joined: 19-Jul-2010
# Posted on: 20-May-2011 14:25:36   

I had query that do the job of sorting like the below one

select * from ABC order by isNull(EndDate, '1/1/2079') desc

[EndDate is the small date time column in the ABC table]

I used like this in my C# code SortExpression sorter = new SortExpression(ABCFields.EndDate | SortOperator.Descending);

But i need the sort expression that do the ordering same as the above query that do the sorting with '1/1/2079' when it found null value... Please help me out.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 20-May-2011 15:34:25   

You will ahve to use a DbFunctionCall for the ISNULL() db function. Set this as the expression for the field used in the SortCLause. And you will have to set the sortClause's EmitAliasForExpressionAggregateField property to false.

A similar example can be seen here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=19769