Quantcast
Channel: SharePoint 2013 - Development and Programming Forum
Viewing all articles
Browse latest Browse all 1404

CAML filter between dates

$
0
0

I'm working in a CEWP for MOSS07 (jquery features) and cannot return the correct sets of data.  I'm pulling from a custom list (imported from Access) with a column of date/time: date only.  I need to pull values where the date is between yesterday and a future date, say 5 days from now.  I've tried multiple combinations of <And> placements and cannot get anything.  The best I get is a set of values that are from yesterday on, but the recordset isn't limited by the <Leq> part.  I'm sure it is a syntax/ordering issue but I cannot peg it.  Anyone? 

The 'gist' of the CAML is below...as I said, I've tried mixing up the different syntax (moving the <And>'s around and turning on & off the IncludeTimeValue flag...I've also switched back and forth between OffsetDays and Offset) but no luck.

I have yet another <Where> that I'd like included (field 'ACTIVE', boolean, true) but I can work around that if the 3rd clause is the problem.  I just need the date range settled.

<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>MOSSEMPLIST</listName> \
<query> \
<Query xmlns=''> \
<Where> \
<And> \
<Geq> \
<FieldRef Name='ANNIV' /> \
<Value Type='DateTime' IncludeTimeValue='False'> \
<Today OffSetDays='-1' /> \
</Value> \
</Geq> \
<Leq> \
<FieldRef Name='ANNIV' /> \
<Value Type='DateTime' IncludeTimeValue='False'> \
<Today OffSet='3' /> \
</Value> \
</Leq> \
</And> \
</Where><OrderBy> \
<FieldRef Name='ANNIV' Ascending='False' /> \
<FieldRef Name='Title' Ascending='True' /> \
</OrderBy> \
</Query> \
</query> \
<viewFields> \
<ViewFields> \
<FieldRef Name='Title'/> \
<FieldRef Name='ANNIV' /> \
<FieldRef Name='SENIORITY' /> \
<FieldRef Name='YEARS' /> \
<FieldRef Name='ACTIVE' /> \
</ViewFields> \
</viewFields> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
**Clarification: If I run certain variations on the above I can get a set of data to return which is <Geq> yesterday but just keeps going ... I can also switch things around and get stuff that is <Leq> the "Today -1"  but never get the Today +3 to limit anything.


If there is a unified theory in which the universe is programmed, my life is a divide-by-zero loop.



Viewing all articles
Browse latest Browse all 1404

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>