I have the following CAML that a developer wrote for me. I would like to add an additional EQ News Category Type to the CAML query in order to return both the News & Memos type of News.
try {
var oInstance = this;
var camlQuery = "";
CSPDebug.write("HomeNews["+oInstance.appletKey+"].generateCAML(dcnIndex='"+dcnIndex+"' kwSearchTerm='"+kwSearchTerm+"')");
var conditions = [];
if ((oInstance.model.dcn[dcnIndex]["_fieldKWS"])&&(kwSearchTerm)) {
var kwConditions = [];
var words = kwSearchTerm.split(' ');
$.each(oInstance.model.dcn[dcnIndex]._fieldKWS, function(index,item) {
$.each(words, function(index2,word) {
if (word)
kwConditions.push(CSPCaml.CreateCAMLStatements("Contains" ,item,"text",word));
});
});
conditions.push(CSPCaml.MergeCAMLStatements(kwConditions, "or" ))
}
conditions.push(CSPCaml.CreateCAMLStatements("Leq", "Date1", "DateTime", CSPDate.FormatDate(new Date(), "DATEFMT_SHAREPOINT")));
conditions.push(CSPCaml.CreateCAMLStatements("Eq", "NewsCategory", "Choice", "News"));
camlQuery = "<Query>";
if (conditions.length)
camlQuery += "<Where>" + CSPCaml.MergeCAMLStatements(conditions, "and" ) + "</Where>";
camlQuery += "<OrderBy><FieldRef Name='SortOrder' Ascending='FALSE' /></OrderBy>";
camlQuery += "</Query>";
CSPDebug.write("HomeNews["+oInstance.appletKey+"] Generated caml query for dcnIndex='"+dcnIndex+"' with kwSearchTerm='"+kwSearchTerm+"' CAML='"+camlQuery+"'");
return camlQuery;
} catch(e) { ExceptionConnector.Handler(EXX.CreateViewModelException("HomeNews", "generateCAML ", e));}
}