We most of the time need one operator, either 'and' Or 'or.
But there are some queries we need to use both these in collaboration. Following example displays how this can be done.
ConditionExpression conditionExpression1 = new ConditionExpression("a", ConditionOperator.Equal, Val);
ConditionExpression conditionExpression2 = new ConditionExpression("b", ConditionOperator.Equal, Val);
ConditionExpression conditionExpression3 = new ConditionExpression("statuscode", ConditionOperator.Equal, 1);
//Adds the or operator conditions
FilterExpression filterExpression = new FilterExpression();
filterExpression.FilterOperator = LogicalOperator.Or;
filterExpression.Conditions = new ConditionExpression[] { conditionExpression1, conditionExpression2 };
//Adds the or operator condition with and Operator condition
FilterExpression filterExpression2 = new FilterExpression();
filterExpression2.FilterOperator = LogicalOperator.And;
filterExpression2.Conditions = new ConditionExpression[] { conditionExpression3 };
filterExpression2.Filters = new FilterExpression[] { filterExpression };
This blog describes mostly about the work (CRM 365, CRM 2016, CRM 2015, CRM2011, CRM 4.0, CRM 3.0, C#,Javascript and SQL Server) i do.
Subscribe to:
Post Comments (Atom)
Retrieving Calendar of a Bookable Resource in Dynamics
There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...
-
There is a bit of change in CRM 2011 than CRM 4. The code is below. Microsoft.Xrm.Sdk. EntityReference Moniker1 = new Microsoft.Xrm.S...
-
When you create a new security role from scratch and then assign only that role to a system user and when you log to the CRM site you might ...
-
There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...
No comments:
Post a Comment