MS CRM 查询表达式 带 CRMBoolean 类型的条件表达式

发布于 2024-11-04 18:37:24 字数 653 浏览 1 评论 0原文

我正在使用 Microsoft 的 CRM 软件(4.0),并且正在尝试构建查询表达式。它仅适用于查询字符串值,但现在我需要包含一个 CRMBoolean 类型的字段。我还应该提到我正在查询自定义实体。

所以以前,在我的查询中,我只会搜索几个字段,但它们都是字符串类型。现在我需要为 CRMBoolean 添加另一个 ConditionExpression。我正在搜索的自定义实体类型有一个名为“条件”的字段 - 其值为“true”或“false”。在 CRM 中,该属性被定义为“位”,但我认为这不会产生任何影响。

这是我试图用来查找条件为“true”的记录的代码:

oCondition = New ConditionExpression()
oCondition.AttributeName = "myEntity_condition"
oCondition.Operator = ConditionOperator.Like

Dim bool As New CrmBoolean
bool.Value = True
oCondition.Values = New Object() {bool}

listConditions.Add(oCondition)

我没有收到错误,但实际上什么也没发生。返回的记录数永远不会以某种方式改变。以前有人这样做过吗?

提前致谢!

I'm using Microsoft's CRM software (4.0) and I'm trying to build a query expression. It works fine with querying only String values, but now I need to include a field that is of type CRMBoolean. I should also mention I'm querying custom entities.

So previously, in my query I would only search by a few fields, but they were all of type String. Now I need to add another ConditionExpression for a CRMBoolean. The type of custom entity I'm searching for has a field called "Condition" - which will either have a value of "true" or "false". In CRM the attribute is defined as a bit, but I didn't think that would make a difference.

Here is my code I'm trying to use to find records that have a condition of "true":

oCondition = New ConditionExpression()
oCondition.AttributeName = "myEntity_condition"
oCondition.Operator = ConditionOperator.Like

Dim bool As New CrmBoolean
bool.Value = True
oCondition.Values = New Object() {bool}

listConditions.Add(oCondition)

I don't get an error, but nothing really happens. The number of records that is returned never changes one way or another. Has anyone done this before?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

任性一次 2024-11-11 18:37:24

无需将 CrmBoolean 对象放入 oCondition.Values 数组中,只需放入常规 true/false 布尔值即可。我也同意 benjynito 将其更改为 ConditionOperator.Equals 而不是 Like。

Instead of putting a CrmBoolean object in the oCondition.Values array, just put a regular true/false boolean. I would also concur with benjynito on changing it to ConditionOperator.Equals instead of Like.

债姬 2024-11-11 18:37:24

我不知道 like 运算符在布尔值上的表现如何。我想知道它是否被忽略了。尝试 ConditionOperator.Equal。

I don't know how the like operator is suppose to behave on a boolean. I wonder if its being ignored. Try ConditionOperator.Equal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文