Sharepoint By Dummies

See Also: http://stephenbooth.brandyourself.com/

Posts Tagged ‘spd2007

Date comparison sometimes uses previous day!

leave a comment »

We have a list which contains a number of date fields, in a dataview connection tot hat list we are using conditional formatting to show/hide alerters depending on if the date has past.  This is on WSS 3.0 and the alerters with their conditional formatting were added using sharepoint designer 2007.  The users reported that sometimes the alterter for overdue (i.e. the date had passed) was appearing a day early.

The XSL inserted by SPD to impklement the conditional formatting is:

<xsl:if test="normalize-space(@STATUS_x0020_FOR_x0020_DASHBOARD) = 'Start Date' and number(translate(substring-before(@Planned_x0020_Start_x0020_Date,'T'),'-','')) > number(translate(substring-before($Today,'T'),'-',''))"><img alt="" src="taxi graphics/Greentick[1].gif" width="16" height="16" /></xsl:if>
<xsl:if test="number(translate(substring-before(@Planned_x0020_Start_x0020_Date,'T'),'-','')) <= number(translate(substring-before($Today,'T'),'-','')) and normalize-space(@STATUS_x0020_FOR_x0020_DASHBOARD) = 'Start Date'"><img alt="" src="taxi graphics/redcross[1].gif" width="16" height="16" /></xsl:if>
<xsl:if test="normalize-space(@STATUS_x0020_FOR_x0020_DASHBOARD) != 'Start Date'"><img alt="" src="taxi graphics/gray tri.jpg" width="10" height="9" /></xsl:if>

We’ve found that in some cases the truncate on the Planned_x0020_Start_x0020_Date field returns the date of the day before the actual date recorded (so for 15-Jun-12 it returns 20120611 rarther than 20120615).

I’ve posted a question about this on EggheadCafe.

Written by stephenboothuk

June 20, 2012 at 2:33 pm

Speeches I Would Have Given

What I would have said at conference

Mark Vale

Tech blog on Microsoft Teams & Stuff

David Hunt, PE... Mechanical Engineer on the loose!

VALUE = Creativity + Diverse Experience + Critical Thinking

catastraspie

A personal blog about having Asperger's

Marc D Anderson's Blog

A Knowledge Management Zealot Speaks Out

Codeless Solutions for SharePoint

Bryon Wyly is a SharePoint Developer dedicated to finding the limits to out-of the-box SharePoint solutions

gordonlyew.wordpress.com/

the political blog of gordon lyew

SharePoint Business Analyst

Just another WordPress.com weblog