sharepoint - CAML IN operator and AND operator with multiple condition -
the following caml query not working me.. not aware sharepoint platform. using sp 2007 , trying use in operator lookup field.
"<where>" + "<and>" + "<and>" + "<in>" + "<fieldref name='role'/>" + "<values>" + "<value type = 'text'>a</value>" + "<value type = 'text'>b</value>" + "</values>" + "</in>" + "<leq>" + "<fieldref name='enddate'/><value type = 'datetime'>" + sputility.createiso8601datetimefromsystemdatetime(dt) + " </value>" + "</leq>" + "</and>" + "<includes>" + "<fieldref name='menu'/><value type='text'>benefits</value>" + "</includes>" + "</and>" + "</where>"; the above query not return have values in list above combination.
if modify query following w/o using in working fine.
"<where>" + "<and>" + "<and>" + "<eq>" + "<fieldref name='role'/>" //+ "<values>" + "<value type = 'text'>a</value>" //+ "<value type = 'text'>b</value>" //+ "</values>" + "</eq>" + "<leq>" + "<fieldref name='enddate'/><value type = 'datetime'>" + sputility.createiso8601datetimefromsystemdatetime(dt) + " </value>" + "</leq>" + "</and>" + "<includes>" + "<fieldref name='menu'/><value type='text'>benefits</value>" + "</includes>" + "</and>" + "</where>"; (please don't suggest me use caml query builder cuz cannot install on dev box. , haven't install sp wss in local :) )
the in operator caml introduced in sharepoint 2010. cannot use in sharepoint 2007. achieve same result have write or's instead.
<or> <eq> <fieldref name='role' /> <value type='text'>a</value> </eq> <eq> <fieldref name='role' /> <value type='text'>b</value> </eq> </or>
Comments
Post a Comment