using some Predicate Expressions

Posts   
 
    
Bola
User
Posts: 14
Joined: 10-Jun-2005
# Posted on: 24-Jun-2005 14:14:41   

If I add some different expressions to the same bucket with "Add", is by default the second expression added with "AND" ??


filter.PredicateExpression.Add(PredicateFactory.CompareValue(PedidoFieldIndex.UcPk,ComparisonOperator.Equal, ucpk));

filter.PredicateExpression.[b]Add[/b](PredicateFactory.Between(PedidoFieldIndex.Fecha, fecha, DateTime.Now));


mattlant
User
Posts: 16
Joined: 24-Jun-2005
# Posted on: 24-Jun-2005 14:25:50   

To be honest, I dont know, however, what I do, and I dont know if this is a no-no but it seems to work fine, I start with AddWithAnd. Doesnt seem to matter how you add the first predicate.


            // filtering
            IPredicateExpression filtExp = new PredicateExpression();
            if(entrantId != -1)
                filtExp.AddWithAnd(PredicateFactory.CompareValue(VehiclesFieldIndex.EntrantId, ComparisonOperator.Equal, entrantId));
            if(seasonId != -1)
                filtExp.AddWithAnd(PredicateFactory.CompareValue(VehiclesFieldIndex.SeasonId, ComparisonOperator.Equal, seasonId));


Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 24-Jun-2005 15:13:28   

Bola wrote:

If I add some different expressions to the same bucket with "Add", is by default the second expression added with "AND" ??


filter.PredicateExpression.Add(PredicateFactory.CompareValue(PedidoFieldIndex.UcPk,ComparisonOperator.Equal, ucpk));

filter.PredicateExpression.[b]Add[/b](PredicateFactory.Between(PedidoFieldIndex.Fecha, fecha, DateTime.Now));


Yes the default is And.

Frans Bouma | Lead developer LLBLGen Pro