Create Filter Expression with AND & OR Condition in Model Driven Apps
Implementation Steps:
Consider a Scenario that I want to make Multiple Filter Condition with Both And/or Condition From Account Table Using Plugins
QueryExpression query = new QueryExpression("account");
query.ColumnSet.AddColumns("accountid");
FilterExpression filterAccount = new FilterExpression(LogicalOperator.Or);
FilterExpression filterName = new FilterExpression(LogicalOperator.And);
filterName.Conditions.Add(new ConditionExpression("NAME_LOGICALNAME", ConditionOperator.Equal, PASSYOURVALUEHERE));
filterName.Conditions.Add(new ConditionExpression("NAME_LOGICALNAME", ConditionOperator.Equal, PASSYOURVALUEHERE));
FilterExpression filterName2 = new FilterExpression(LogicalOperator.And);
filterName2.Conditions.Add(new ConditionExpression("NEWFIELD_LogicalName", ConditionOperator.Equal, id2));
filterName2.Conditions.Add(new ConditionExpression("NEWFIELD_LogicalName", ConditionOperator.Equal, id3));
filterAccount.AddFilter(filterName);
filterAccount.AddFilter(filterName2);
query.Criteria = filterAccount;
In the Above Example Am using Both And/OR Condition in FilterExpression with QueryExpression.
That's it 🙂
Comments
-
Create Filter Expression with AND & OR Condition in Model Driven Apps
Hi There,
I'm new to PowerApps and hoping to get some help. I've created a gallery grid using an exceptional video posted by Reza Dorrani. Everything seems to work out perfectly except that when I update an existing record, for some reason new records also gets added to the gallery grid and sharepoint. Where would I go to fix this issue? Below is the Onselect statement used:
If(
varGridEdit,
Patch(
PSRA_Events_Response_Form,
colGridData
));
Notify(
"Form Data Updated",
NotificationType.Success,
2000
);
Select(btnLoadData);
Set(
varGridEdit,
!varGridEdit
)Thank you so much in advance for your feedback on this.
Lynn
*This post is locked for comments