This topic is locked

Need to do a color code based on date and time fields

12/30/2008 1:41:26 PM
ASPRunnerPro General questions
M
mfred author

I am using ASPRunnerPro 6.x to write scheduling applications. My current applications have a Due_Date field using the format as 12/3/2008 and a Due_Time field which records world time (0900, 1000, etc.) in the database but displays the time in the browser as AM 9:00, AM 10:00, etc.) I need to color code the rows or at least the date and/or time fields in colors as red if past due, yellow if 1 hour from due and green if 2 hours from due. This is more than the tips and forumns show how. Any assistance is appreciated.
I nearly forgot, the color coding should display only if a third field called Status shows "in progress".

J
Jane 1/6/2009

Hi,
to change field color use custom format on the "View as" settings dialog on the Visual Editor tab.

Here is a sample:

http://www.asprunner.com/forums/index.php?showtopic=5778
All field values are stored in the rs collection, I.e. rs("Field1"), rs("Field2"), etc.

M
mfred author 1/12/2009

Thank you. However, the complication that I noted is that the criteria for color coding is that the colors are based on status is in progress and the proximity of the due date and due time. Any further suggestions are appreciated.

J
Jane 1/13/2009

Hi,
here is just a sample:

if rs("FieldName1")="in progress" and datediff("d",rs("FieldName2"),rs("FieldName3"))>111 then

...

end if



Also I recommend you to have a look at this article:

http://www.w3schools.com/vbScript/func_datediff.asp