Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to create a view for a calendar. The view must display only currently running events.

Right now, I can create a view that filter on for daily event : I currently filter events with Start Date <= [Today] AND End Date >= [Today].

If this was MS Access, I'd do Start Date <= [Now] AND End Date >= [Now], but [Now] doesn't exist in MOSS 2007...

How could I filter my events on an (at least) hourly basis?

Sidenote : This list is used to have a quick look at currently running maintenances for a list of servers. Alternative solution are welcome.

share|improve this question

2 Answers 2

The [Today] filter is not getting you what you want? You might need to add an additional filter like Status does not equal Complete or Statusequals In Progress to weed out other data.

If you have access to Sharepoint Designer, you can use your own CAML or use other XSLT filters to get more precise than [Today].

You could also utilize jQuery to do client side filtering or roll your own display utilizing SPServices where you have control over the CAML.

share|improve this answer
    
No, [Today] is not enough. I don't want a red flag to be raised for the whole day when there's a maintenance during the morning only (example). I also do not want to have to update a Status field to update manually. I'm not sure I can get access to SP Designer, I'll ask. Finally, I doubt I can use jQuery since the list is used in another webpart... –  Kraz Jun 13 '11 at 14:54
    
+1 Since I had to toy with XSL filters to find a way to do it. I'll post the solution I went it. –  Kraz Jun 20 '11 at 16:46
up vote 0 down vote accepted

To allow myself to do that, I used the Custom Query WebPart.

In its webPart declaration, I used this property :

<property name="QueryOverride" type="string">
<![CDATA[
<Where>
    <And>
        <Leq>
            <FieldRef Name="EventDate" Nullable="False" Type="DateTime"/>
            <Value Type="DateTime" IncludeTimeValue="TRUE">
            <Today />
            </Value>
        </Leq>
        <Geq>
            <FieldRef Name="EndDate" Nullable="False" Type="DateTime"/>
            <Value Type="DateTime" IncludeTimeValue="TRUE">
            <Today />
            </Value>
        </Geq>
    </And>
</Where>
<OrderBy>
    <FieldRef Name="Systeme" Nullable="False" Type="Text" Ascending="True"/>
</OrderBy>
]]>
</property>

The key info is the IncludeTimeValue="TRUE" part.

Note: Do not put crlf or space between nodes.

After that, I had to design a custom view for the webpart...

This is not a filter on the calendar list (as I originally wanted). This seems to be impossible.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.