Solved

need CAML help for DVWP

Posted on 2012-03-29
4
460 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

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…
Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 do not offer the option to configure the location of the SharePoint diagnostic trace log files during installation.  This can, however, be configured through Central Administr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now