Hi Rich,
You could do that this way:
// the OR part
PredicateExpression firstFilter = new PredicateExpression();
firstFilter.Add(new FieldCompareValuePredicate(Talbe1.Foo, ComparisonOperator.Equal, somevalue));
firstFilter.AddWithOr(new FieldCompareValuePredicate(Talbe1.Bar, ComparisonOperator.Equal, somevalue));
// the AND part
PredicateExpression secondFilter = new PredicateExpression();
secondFilter.AddWitnAnd(new FieldCompareValuePredicate(Talbe2.Foo, ComparisonOperator.Equal, somevalue));
secondFilter.AddWitnAnd(new FieldCompareValuePredicate(Talbe2.Bar, ComparisonOperator.Equal, somevalue));
// two parts together. The Add(...) method performs the Add with AND by default.
PredicateExpression filter = new PredicateExpression();
filter.Add(firstFilter);
filter.Add(secondFilter);
Or better:
// the OR part
PredicateExpression firstFilter = new PredicateExpression(Table1Fields.Foo == someValue | Talbe1Fields.Bar == somevalue);
// the AND part
PredicateExpression secondFilter = new PredicateExpression(Talbe2Fields.Foo == somevalue & Talbe2Fields.Bar == somevalue);
// two parts together. The Add(...) method performs the Add with AND by default.
PredicateExpression filter = new PredicateExpression();
filter.Add(firstFilter);
filter.Add(secondFilter);
Or better (the easiest way):
PredicateExpression filter = (Table1Fields.Foo == someValue | Talbe1Fields.Bar == somevalue) & (Talbe2Fields.Foo == somevalue & Talbe2Fields.Bar == somevalue));
Read more info about the predicate system....