I am using ClientContext Class and CAML query to retrieve items from External List in sharepoint 2010.I have built the query with Logical AND Condition in CAML Query like this
string sDataFilter =<Query><Where><And><Eq><FieldRef Name="Year" /><Value Type="Text">1960</Value></Eq><Contains><FieldRef Name="ChartName" /><Value Type="Text">Chart1</Value></Contains></And></Where></Query>
When I exceute the following code
List oList = clientContext.Web.Lists.GetById(new Guid(list)); CamlQuery camlQuery = new CamlQuery(); string queryContext = "<View><Query>" + sDataFilter + "</Query>" + viewFieldsContext + "</View>"; camlQuery.ViewXml = queryContext; ListItemCollection collListItem = oList.GetItems(camlQuery); clientContext.Load(collListItem); clientContext.ExecuteQuery();
I am getting the empty ListItemCollection.I have cross verified with the U2U CAML Query Builder the data is empty only. So in External List the caml query is working fine for sorting and simple filter query like Where,EqualTo condition I can't use Logical conditions in the query ? If yes how could I achieve this using caml query Could anyone help me to resolve this issue ?