Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top