本文介绍了SharePoint CAML 查询 AND/OR 运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您能帮助我使 CAML 查询正常工作,我将不胜感激.我有以下列表:

|身份证 |部门 |状态 |

我试图让查询返回 list items where ID=1, Department=Audit, and Status="Stopped" OR "In Progress".

有人可以帮忙吗?

问候,

解决方案

查询:

<哪里><并且><等式><FieldRef Name='ID'/><值类型='计数器'>1</值></Eq><并且><等式><FieldRef Name='部门'/><值类型='选择'>审计</值></Eq><或><等式><FieldRef Name='Status'/><值类型='选择'>进行中</值></Eq><等式><FieldRef Name='Status'/><Value Type='Choice'>未开始</Value></Eq></或></并且></并且></哪里></查询>

注意:假设Department是一个Choice字段

我建议您使用可帮助您构建 CAML 查询的工具,例如 U2U Caml Query Builder

I would appreciate any help on getting my CAML query to work.I have the following list:

| ID | Department | Status |

I am trying to get the query to return list items where ID=1, Department=Audit, and Status= "Stopped" OR "In Progress".

Can anyone please help?

Regards,

解决方案

Query:

<Query>
   <Where>
      <And>
         <Eq>
            <FieldRef Name='ID' />
            <Value Type='Counter'>1</Value>
         </Eq>
         <And>
            <Eq>
               <FieldRef Name='Department' />
               <Value Type='Choice'>Audit</Value>
            </Eq>
            <Or>
               <Eq>
                  <FieldRef Name='Status' />
                  <Value Type='Choice'>In Progress</Value>
               </Eq>
               <Eq>
                  <FieldRef Name='Status' />
                  <Value Type='Choice'>Not Started</Value>
               </Eq>
            </Or>
         </And>
      </And>
   </Where>
</Query>


I would recommend you to utilize the tool that will help you build your CAML Queries, for example U2U Caml Query Builder

这篇关于SharePoint CAML 查询 AND/OR 运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 16:51