|
2 | 2 | title: "Use the ConditionExpression class (Common Data Service) | Microsoft Docs" # Intent and product brand in a unique string of 43-59 chars including spaces
|
3 | 3 | description: "Read how you can use the ConditionExpression class to compare an attribute to a value or set of values by using an operator, such as "equal to" or "greater than"" # 115-145 characters including spaces. This abstract displays in the search result.
|
4 | 4 | ms.custom: ""
|
5 |
| -ms.date: 10/31/2018 |
| 5 | +ms.date: 08/03/2020 |
6 | 6 | ms.reviewer: "pehecke"
|
7 | 7 | ms.service: powerapps
|
8 | 8 | ms.topic: "article"
|
@@ -105,20 +105,28 @@ public ConditionExpression
|
105 | 105 | )
|
106 | 106 | ```
|
107 | 107 |
|
108 |
| -In the SDK, two APIs are introduced to support column comparison. The |
109 |
| -first identifies the original attribute, the second allows |
110 |
| -for the inclusion of the attribute you want to compare it against. |
| 108 | +By passing in `true` as the value for the `compareColumns` parameter, the `value` is treated as the |
| 109 | +name of the second attribute to compare the values in `attributeName` to. Pass in `false` to treat it |
| 110 | +as a literal value instead. |
111 | 111 |
|
112 |
| -If `compareColumns` is passed in as `true`, it will compare the two attributes |
113 |
| -and return all records that match. |
| 112 | +For example: |
114 | 113 |
|
115 |
| -If a `false` value is passed, it will return all records for one attribute and |
116 |
| -return values that match the provided value. |
| 114 | +```csharp |
| 115 | +new ConditionExpression("firstname", ConditionOperator.Equal, true, "lastname"); |
| 116 | +``` |
| 117 | + |
| 118 | +This code creates a condition to return only records where the first and last names are the same, while |
| 119 | + |
| 120 | +```csharp |
| 121 | +new ConditionExpression("firstname", ConditionOperator.Equal, false, "John"); |
| 122 | +``` |
| 123 | + |
| 124 | +creates a condition to return only records where the first name is John. |
117 | 125 |
|
118 | 126 | More information: [Use column comparison in queries](../column-comparison.md)
|
119 | 127 |
|
120 | 128 | ### See also
|
121 | 129 | [Building Queries](build-queries-with-queryexpression.md)
|
122 | 130 | [Build Queries with QueryExpression](build-queries-with-queryexpression.md)
|
123 | 131 | [Use the FilterExpression Class](use-filterexpression-class.md)
|
124 |
| - <xref:Microsoft.Xrm.Sdk.Query.ConditionExpression> |
| 132 | + <xref:Microsoft.Xrm.Sdk.Query.ConditionExpression> |
0 commit comments