0

I am trying to fetch the result from list based on 3 conditions( Month Name,Employee,Department).

In my SharePoint List(Month Name is calculated column fetching month from column "Joining Date") .

Below is the caml query trying to get fetech the value using column(Month Name) but found no luck.I had gone through the internal of the column "Month Name" and I see "Month" as internal name

can any one help me in knowing what went wrong in below code

var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<View><Query><Where><And><Eq><FieldRef Name='Employee'/><Value Type='Text'>" + Employee + "</Value></Eq><Eq><FieldRef Name='Department'/><Value Type='Text'>" + Department+ "</Value></Eq><Eq><FieldRef Name='Month Name'/><Value Type='Calculated'>" + monthname+ "</Value></Eq></And></Where></Query></View>")
1
  • You can only nest two Eq directly in one And statement, so you need to add another And statement Mar 7, 2016 at 7:32

1 Answer 1

0

You can only nest two Eq directly in one And statement, so you need to add another And statement, like this:

var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<View><Query><Where><And><Eq><FieldRef Name='Employee'/><Value Type='Text'>" + Employee + "</Value></Eq><And><Eq><FieldRef Name='Department'/><Value Type='Text'>" + Department+ "</Value></Eq><Eq><FieldRef Name='Month Name'/><Value Type='Calculated'>" + monthname+ "</Value></Eq></And></And></Where></Query></View>")
3
  • Thanks for your response.But I don't get the result.I am confused about the column name(Should i use the internal name for the column(Month Name) or use it's display name)I renamed the column to MonthName ,But found no luck .
    – MSA
    Mar 7, 2016 at 10:10
  • You need to use internal name Mar 7, 2016 at 11:09
  • Thanks for Response.but Found no luck
    – MSA
    Mar 7, 2016 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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