Sort Expression with Alias

Posts   
 
    
arschr
User
Posts: 894
Joined: 14-Dec-2003
# Posted on: 12-Aug-2010 15:45:11   

(Adapter v2.6)

A developer was migrating code to v2.6 that used SortClauseFactory. He was setting alias and was having trouble setting them with the new syntax. The following was the best I could come up with. Is there a way to set the alias in the constructor? or a less ugly way to set it after the fact.


var sortExpression = new SortExpression(CustomerFields.CustomerCode |  SortOperator.Ascending);
sortExpression[0].ObjectAlias = "Cust";

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 12-Aug-2010 20:37:59   

You can use the syntax

CustomerFields.CustomerCode.SetObjectAlias("Cust")

Matt

arschr
User
Posts: 894
Joined: 14-Dec-2003
# Posted on: 12-Aug-2010 23:17:40   

So I could to it like this:



var sortExpression = new SortExpression(CustomerFields.CustomerCode.SetObjectAlias("Cust") | SortOperator.Ascending);

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Aug-2010 07:02:58   

arschr wrote:

So I could to it like this:



var sortExpression = new SortExpression(CustomerFields.CustomerCode.SetObjectAlias("Cust") | SortOperator.Ascending);

Indeed wink

David Elizondo | LLBLGen Support Team