CAML Gt AND Lt AND calculated field AND the wicked U2U CAML Query Builder

U2U CAML Query Builder is a must have tool for SharePoint developers, but today it was giving me grief.

I have a calculated column called ‘Duration (months)’. I wanted to find items where duration is less than 24 and more than 6.

I used U2U to generate the query using LT and GT but it was returning no items. The weird thing is when I removed the AND (i.e. single condition) or replace the AND with OR, then it was returning items.

It turns out that it was because U2U was putting ‘Calculated’ as the Value Type. When I changed the type to ‘Number’ (i.e. the OutputType of the calculated field) then everything works!

Advertisements

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in CAML, SharePoint, SPFieldCalculated. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s