Hello everybody,
Could somebody please help me with the following question. How can I add parentheses (round brackets) in my query.
I have defined ResultsetFields, created bkt as IRelationPredicateBucket and defined Relations, then I've added PredicateExpressions:
bkt.PredicateExpression.AddWithAnd(New FieldCompareValuePredicate(PartLocationSettingsFields.ReorderWarningFlag, Nothing, ComparisonOperator.Equal, True))
bkt.PredicateExpression.AddWithAnd(PartInventoryAdjustmentFields.LocationId = PartLocationSettingsFields.LocationId)
bkt.PredicateExpression.AddWithOr(New FieldCompareNullPredicate(PartInventoryAdjustmentFields.LocationId, Nothing, False))
bkt.PredicateExpression.AddWithOr(New FieldCompareNullPredicate(PartLocationSettingsFields.LocationId, Nothing, False))
When I run FetchTypedList(flds, dt, bkt, sorter, True, gb) in the query I have ...
WHERE ( ( partlocationsettings
.ReorderWarningFlag
= @ReorderWarningFlag1 AND partinventoryadjustment
.LocationId
= partlocationsettings
.LocationId
OR partinventoryadjustment
.LocationId
IS NULL OR partlocationsettings
.LocationId
IS NULL))
How can I make it look like this (I've tried other combinations but they did not work out):
WHERE ( partlocationsettings
.ReorderWarningFlag
= @ReorderWarningFlag1 AND (partinventoryadjustment
.LocationId
= partlocationsettings
.LocationId
OR partinventoryadjustment
.LocationId
IS NULL OR partlocationsettings
.LocationId
IS NULL))
Thanks a lot in advance,
Galina.