Bitwise AND in selection predicate

Posts   
 
    
ww
User
Posts: 83
Joined: 01-Oct-2004
# Posted on: 25-Apr-2013 23:02:01   

LLBLGen Pro 3.5, Adapter.

I need to select from MyEntity where (aField & 32)==32.

I see I can create Expression(EntityFields.aField,ExOp.BitwiseAnd,32) but I'm stuck on how to work this into my PredicateExpression.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 25-Apr-2013 23:38:51   

Basically that's a normal FieldComparePredicate. But the field used has an expression applied to it.

So just set the ExpressionToApply property of the entityField in hand to set your bitwise expression, and then use that entityField in the predicate.

Pseudo Code:

myEntityField.ExpressionToApply = exp;

predicateExpression.Add(myEntityField == 32);

ref: Using Expressions

ww
User
Posts: 83
Joined: 01-Oct-2004
# Posted on: 28-Apr-2013 19:34:08   

I never realized you could set expressions that way. Thanks.