Solved

need CAML help for DVWP

Posted on 2012-03-29
4
491 Views
Last Modified: 2012-08-14
I insertered a dvwp filtered by start time >=current date and end time <='1/23/2013' so it would be easy to find.

I would like the end date to be 13 months from the current date

here is the current code:

selectcommand="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;And&gt;&lt;Geq&gt;&lt;FieldRef Name=&quot;EventDate&quot;/&gt;&lt;Value Type=&quot;DateTime&quot;&gt;&lt;Today/&gt;&lt;/Value&gt;&lt;/Geq&gt;&lt;Leq&gt;&lt;FieldRef Name=&quot;EndDate&quot;/&gt;&lt;Value Type=&quot;DateTime&quot;&gt;2013-01-23T14:37:34Z&lt;/Value&gt;&lt;/Leq&gt;&lt;/And&gt;&lt;/Where&gt;&lt;OrderBy&gt;&lt;FieldRef Name=&quot;EventDate&quot; Ascending=&quot;TRUE&quot;/&gt;&lt;/OrderBy&gt;&lt;/Query&gt;&lt;/View&gt;"

is it possible to do what I want to do?
0
Comment
Question by:sullisnyc44
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
svetaye earned 500 total points
ID: 37783968
Hello,
In general you can use the "OffsetDays" property to get the date.
Unfortunately you can only use days number as a offset, not months:

<Where>
<Geq>
<FieldRef Name="EndDate" />
<Value Type="DateTime">
<Today OffsetDays="390" />
</Value>
</Geq>
</Where>

Please see this for more info:
http://msdn.microsoft.com/en-us/library/ms460496.aspx
0
 

Author Comment

by:sullisnyc44
ID: 37787662
thx. ok - so do I over write my code to read 'selectcommand=...' add your code?

Will it display the date range between the current date and 13 months out?
0
 

Author Comment

by:sullisnyc44
ID: 37789059
if I try to change the commmand to this I get a 'non specific data error'

"&lt;View&gt;&lt;Query&gt;&lt;&lt;Where&gt;&lt;Geq&gt;&lt;FieldRef Name=\&quot;EventDate\&quot; /&gt;&lt;Value Type=\&quot;DateTime\&quot;&gt;&lt;Today OffsetDays=\&quot;390\&quot; /&gt;&lt;/Value&gt;&lt;/Geq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;"
0
 
LVL 11

Expert Comment

by:svetaye
ID: 37789296
This is the exact code, just copy the "selectcommand" property value:

<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" UseServerDataFormat="True" selectcommand="<Query>
<Where>
      <Geq>
      <FieldRef Name='EndDate' />
      <Value Type='DateTime'>
      <Today OffsetDays='390' />
      </Value>
      </Geq>
</Where>
</Query>" id="dataformwebpart1">
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently came across an issue with a MOSS 2007 deployment where access into some sub-sites were denied, even for the MOSS farm administrators. A bit of background to the setup of this MOSS farm; this was a three server setup, consisting of a fr…
We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question