Textual query syntax

Posts   
 
    
mattsmith321 avatar
Posts: 146
Joined: 04-Oct-2004
# Posted on: 23-Mar-2006 23:43:29   

I'm 99% sure that I saw a thread somewhere where Frans gave a very brief example of the upcoming simplified syntax. Can anyone point me back to that thread?

I'm trying to introduce LLBL Gen in a small project at work and I was originally hoping that the syntax had changed in this last release but after an hour of searching and reading, it appears that it won't be in until v2.0. That's correct, right?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39798
Joined: 17-Aug-2003
# Posted on: 24-Mar-2006 00:31:08   

No, it's available in 1.0.2005.1 simple_smile It's stored in the filtering and sorting section of the manual. In there in 'the predicate system' you find code which formulates both, so you can see the differences. Example:


...
WHERE   TableFields.Foo = "One" OR 
        TableFields.Foo = "Two" OR 
        TableFields.Foo = "Three" OR
        TableFIelds.Foo = "Four"
you should use this code: 
// C#
IPredicateExpression filter = 
    ((TableFields.Foo=="One") | (TableFields.Foo=="Two"))
    .AddWithOr(TableFields.Foo=="Three")
    .AddWithOr(TableFields.Foo=="Four);
    
// which is equal to:
IPredicateExpression filter = new PredicateExpression();
filter.Add(TableFields.Foo=="One")
    .AddWithOr(TableFields.Foo=="Two")
    .AddWithOr(TableFields.Foo=="Three")
    .AddWithOr(TableFields.Foo=="Four);
    
// which is equal to:
IPredicateExpression filter = new PredicateExpression();
filter.Add(PredicateFactory.CompareValue(TableFieldIndex.Foo, ComparisonOperator.Equal, "One"))
    .AddWithOr(PredicateFactory.CompareValue(TableFieldIndex.Foo, ComparisonOperator.Equal, "Two"))
    .AddWithOr(PredicateFactory.CompareValue(TableFieldIndex.Foo, ComparisonOperator.Equal, "Three"))
    .AddWithOr(PredicateFactory.CompareValue(TableFieldIndex.Foo, ComparisonOperator.Equal, "Four"));

Frans Bouma | Lead developer LLBLGen Pro
mattsmith321 avatar
Posts: 146
Joined: 04-Oct-2004
# Posted on: 24-Mar-2006 15:11:53   

Otis wrote:

No, it's available in 1.0.2005.1 simple_smile

Awesome! That will make it a little easier to get people up to speed. Sorry I missed it in the doco. Predicates are just something that I dealt with because I had to and not because I really took the time to understand them (plus it's been 9+ months since I've actually written any LLBL code).

Thanks again!