?
Solved

need CAML help for DVWP

Posted on 2012-03-29
4
Medium Priority
?
519 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
svetaye earned 2000 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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

There is one common problem that all we SharePoint developers share: custom solution deployment. This topic can't be covered fully in this short article, so all I want to do in this one is to review it from a development-to-operations perspectiv…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

752 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