Configuration

BrightWork Tip: Learn to Use CAML Query – Part 2

August 2, 2017 by

Following the last blog, Learn CAML Statements Part 1, this blog looks at some of the CAML comparison operators that can be used within Collaborative Application Markup Language (CAML) queries. There are a few not listed i.e. In, Includes, NotIncludes, as these are not supported at present in BrightWork.

CAML Comparison Operators

In the example above, the <Eq> is a comparison operator. It looks to see if one value equals another. There are many different types available in CAML.

NOTE: CAML is case sensitive

 

Query

Open

Close

Syntax Example

Details

Equals<Eq></Eq> 

<Where>
<Eq>
<FieldRef Name=’AssignedTo’ />
<Value Type=’UserMulti’>John Doe</Value>
</Eq>
</Where>

 

Assigned to is equal to ‘John Doe’
Not Equals<Neq></Neq> 

<Where>
<Neq>
<FieldRef Name=’AssignedTo’ />
<Value Type=’UserMulti’>[Me]</Value>
</Neq>
<Where>

 

Assigned to is not equal to ‘Me’ i.e. the logged in user
Greater Than<Gt></Gt> 

<Where>
<Geq>
<FieldRef Name=’DueDate’ />
<Value IncludeTimeValue=’TRUE’ Type=’Date’>2017-06-13</Value>
</Geq>
</Where>

 

Due Date is greater than ‘2017-06-13’
Greater Than or Equal To<Geq></Geq> 

<Where>
<Geq>
<FieldRef Name=’DueDate’ />
<Value IncludeTimeValue=’TRUE’ Type=’Date’>2017-06-13</Value>
</Geq>
</Where>

 

Due Date is greater than ‘2017-06-14’
Less Than<Lt></Lt> 

<Where>
<Lt>
<FieldRef Name=’PercentComplete’ />
<Value Type=’Number’>50</Value>
</Lt>
</Where>

 

PercentComplete is less than 50
Less Than or Equal To<Leq></Leq> 

<Where>
<Leq>
<FieldRef Name=’PercentComplete’ />
<Value Type=’Number’>50</Value>
</Leq>
</Where>

 

PercentComplete is less or equal to than 50
Is Null<IsNull></IsNull> 

<Where>
<IsNull>
<FieldRef Name=’AssignedTo’ />
</IsNull>
</Where>

 

Assigned to is null / Assigned to contains no value
Is Not Null<IsNotNull></IsNotNull> 

<Where>
<IsNotNull>
<FieldRef Name=’Attachments’ />
</IsNotNull>
</Where>

 

Attachment is not null /Item has an attachement
Contains<Contains></Contains> 

<Where>
<Contains>
<FieldRef Name=’Status’ />
<Value Type=’Choice’>Late</Value>
</Contains>
</Where>

 

Status contains ‘Late’
Begins With<BeginsWith></BeginsWith> 

<Where>
<BeginsWith>
<FieldRef Name=’Priority’ />
<Value Type=’Choice’>(2)</Value>
</BeginsWith>
</Where>

 

Priortiy begins with ‘(02)’
Membership<Membership

Type = “Text”>

</Membership> 

<Where>
<Membership Type=”BrightWork Members”>
<FieldRef Name=”AssignedTo” /></Membership>
</Where>

 

The person listed in ‘AssignedTo’ is a member of the group ‘BrightWork Members’

 

Over the coming weeks and months, I’ll post more about how you can use CAML code within BrightWork to advance the configuration of BrightWork Reports and metrics. If there is anything specific, please post in the comments below. Or search our blog to find more interesting articles on CAML, including Making use of Shared Filters and the Web Part Gallery.

 

 

Pin It on Pinterest

Share This