Problem adding multiple SortClauses

Posts   
 
    
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 21-Jul-2006 21:16:25   

The docs say this will work:

Dim sorter As New SortExpression(CustomerFields.Country Or SortOperator.Ascending) And _

            (CustomerFields.CompanyName Or SortOperator.Descending)

But we're trying to do this (Yes, the table names are real, but ignore that insanity)

Dim sort As New SortExpression

sort.Add(VwrHr180w8Fields.Clastname or SortOperator.Ascending) and (vwrhr180w8fields.cfirstname or sortoperator.ascending) and (vwrhr180w8fields.cmi or sortoperator.ascending)

The difference is that the docs suggest that adding multiple sort clauses is possible, at least in the constructor. I would think the same would be possible from the SortExpression.Add function.

Wutcha think?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 22-Jul-2006 03:16:23   

Does it work for you if you call add multiple times?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 22-Jul-2006 09:47:29   

The 'and' results in a new sortexpression, what you're doing isn't what's suggested in the docs. Which part of the docs are you referring to exactly?

Frans Bouma | Lead developer LLBLGen Pro
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 24-Jul-2006 14:19:25   

Otis wrote:

The 'and' results in a new sortexpression, what you're doing isn't what's suggested in the docs. Which part of the docs are you referring to exactly?

Yes, if I call Add multiple times, it works. The docs don't even say I can do what I'm trying to do. It just seemed like it would be possible considering you can do the same thing with Predicates. The first example above is from the docs. The second block is my what I attempted (and failed) to do.

It's not that big of a deal.

alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 24-Jul-2006 14:20:57   

BTW, jspaonocsi and I are both working on the same project for the same company so feel free to catagorize us as "That annoying CSI crowd" simple_smile

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 25-Jul-2006 07:23:32   

Would you please try this:

Dim sort As New SortExpression
sort.Add((VwrHr180w8Fields.Clastname or SortOperator.Ascending) and (VwrHr180w8Fields.cfirstname or sortoperator.ascending) and (VwrHr180w8Fields.cmi or sortoperator.ascending))

Note the extra brackets.

alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 25-Jul-2006 17:09:35   

Walaa wrote:

Would you please try this:

Dim sort As New SortExpression
sort.Add((VwrHr180w8Fields.Clastname or SortOperator.Ascending) and (VwrHr180w8Fields.cfirstname or sortoperator.ascending) and (VwrHr180w8Fields.cmi or sortoperator.ascending))

Note the extra brackets.

Sorry.

Error 2 Option Strict On disallows implicit conversions from 'SD.LLBLGen.Pro.ORMSupportClasses.SortExpression' to 'SD.LLBLGen.Pro.ORMSupportClasses.ISortClause'. 

This is someone else's response on our team so I don't have the liberty of attempting a cast.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 25-Jul-2006 21:31:42   

Please use multiple Add() statements.

Frans Bouma | Lead developer LLBLGen Pro