Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Sorting a collection on 2 fields (1 is easy)
 

Pages: 1
LLBLGen Pro Runtime Framework
Sorting a collection on 2 fields (1 is easy)
Page:1/1 

  Print all messages in this thread  
Poster Message
like2175
User



Location:
Camberley, United Kingdom
Joined on:
27-Mar-2006 16:16:06
Posted:
83 posts
# Posted on: 05-Apr-2007 13:43:32.  
I have filled a collection using
Code:
paramColl = _rep.GetMultiAppParam(False, Nothing, Nothing)

I now need to sort by 2 attributes: DisplayOrder, then ParamName

I can do this:
Code:
        Dim sorter1 As New SortExpression
        sorter1.Add(SortClauseFactory.Create(AppParamFieldIndex.DisplayOrder, SD.LLBLGen.Pro.ORMSupportClasses.SortOperator.Ascending))
         sorter1.Add(SortClauseFactory.Create(AppParamFieldIndex.ParamName, SD.LLBLGen.Pro.ORMSupportClasses.SortOperator.Ascending))


And:
Code:
.Sort(AppParamFieldIndex.DisplayOrder, ComponentModel.ListSortDirection.Ascending)

allows me to sort by 1 field.
Can anyone help me sort my collection by 2 fields?

LLBLGen v 1.0.2005.1
ASP.NET v2.0
Oracle DB.
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 05-Apr-2007 15:52:43.  
To sort os the database side when you fetch a collection, you should supply a sort expression to the fetch method.
Code:
Dim sorter1 As New SortExpression
        sorter1.Add(SortClauseFactory.Create(AppParamFieldIndex.DisplayOrder, SD.LLBLGen.Pro.ORMSupportClasses.SortOperator.Ascending))
         sorter1.Add(SortClauseFactory.Create(AppParamFieldIndex.ParamName, SD.LLBLGen.Pro.ORMSupportClasses.SortOperator.Ascending))


To sort a collection at the client side (after it has been fetched), you should use the sort method which sorts on only one field
Code:
.Sort(AppParamFieldIndex.DisplayOrder, ComponentModel.ListSortDirection.Ascending)

This has changed in v.2.0 where you can use an EntityView to sort a collection on multiple fields at client side.


  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.