I have a calculated column that stores the calculated date value.

When I apply the CAML query, it does not return any row even if the record exists.

  • Hi Mansi. I know it has been a while since you posted this question but I recently had a scenario similar to yours. The only way I solved it was to first load ALL the list items within the list into a ListItemCollection specifying the fields making up the Calculated column in the <ViewFields>, and then I used LINQ on all the ListItemCollection whilst at the same time re-creating the Calculated column within the query. I could post an answer with more detail if this is still a problem for anyone or if anyone is interested to know more about my "solution" – Jurgen Cuschieri Aug 1 '17 at 7:10

You have to use Value Type equals your OutputType rather than Calculated in CAML query.

// This will not work >> <Value Type='Calculated'>my value</Value>

// Following will work
    <FieldRef Name='FullName' />
      <Value Type='Text'>my value</Value>

Read this link: CAML Query on Calculated Fields

|improve this answer|||||
  • I don't think this is correct. I had recreated this problem and Calculated fields never returned results for me, even if I was sure they existed within the list/library. – Jurgen Cuschieri Aug 1 '17 at 7:06

This might be related to what you use as value type in your CAML. The type must be the return type of your calculation for example it might be 'Number'

|improve this answer|||||

I used the FieldInternalName instead of the custom name of the field to make the Ronak Patel's solution working.

Who could not make it work:

The caluclated SharePoint field also has FieldInternalName which is generated at the first time when the field is created.

Once the field is renamed then the FieldName is changing accordingly, but the FieldInternalName not. You can get the calc field FieldInternalName from the display form by F12 - developer tool selecting calculated field element td#SPFieldCalculated as this field type is not visible on the New or Edit Forms.

|improve this answer|||||

This is the simplest explanation that should help.


|improve this answer|||||
  • 1
    I have the same problem with no results. This points me in the right direction, I think, but my query still isn't returning any results. – CigarDoug Jun 11 '13 at 10:20
  • Please don’t add just a link as answer to a question. If the link breaks, the answer you provided will not be useful for future visitors. Provide an answer of your own and use the link as reference. If needed, you can block quote the content from your link. More information is found in our help center, especially How do I write a good answer – Benny Skogberg Mar 30 '18 at 13:51
  • Please explain here, link is not working – Rishi Jagati Feb 6 '19 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.