Solved

need CAML help for DVWP

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

A question that is asked often, is how to generate sequential numbers in InfoPath Forms. The best way to achieve this is to use a SQL database, along with a stored procedure and a web service to connect Forms Services to the DB. The first thing t…
The Scenario: Let’s say you have a quote worksheet in Excel that you use to work up sales figures and such for your clients. You utilize SharePoint to manage and keep track of these documents. You would like values from your worksheet to populate Sh…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

914 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

16 Experts available now in Live!

Get 1:1 Help Now