How to turn fld green, red, yellow depending on when due.
Posted: Sat Sep 13, 2014 5:02 pm
I'm trying to get a fld turn colors depending on when something is due or not due. Example: turn yellow when something is coming due, red when it is due or past due, and green when it's good. Can someone help me out with the below code. Can't seem to get it right.
Code: Select all
put 8 into t8Day -- the num of days
put the seconds into tTodaySec
put 86400 * t8Day into tTimePassed
put tTodaySec + tTimePassed into tDaysec
convert tDaysec to short date
--answer "In " && t8Day && "day we will be the" && tDaysec
put 7 into t7Day -- the num of days
put the seconds into tTodaySec
put 86400 * t7Day into tTimePassed
put tTodaySec + tTimePassed into tDaysec
convert tDaysec to short date
answer "In " && t7Day && "day we will be the" && tDaysec
put -7 into tM7Day -- the num of days
put the seconds into tTodaySec
put 86400 * tM7Day into tTimePassed
put tTodaySec + tTimePassed into tDaysec
convert tDaysec to short date
answer "In " && tM7Day && "day we will be the" && tDaysec
put 1 into t1Day -- the num of days
put the seconds into tTodaySec
put 86400 * t1Day into tTimePassed
put tTodaySec + tTimePassed into tDaysec
convert tDaysec to short date
--answer "In " && t1Day && "day we will be the" && tDaysec
if fld "fld1" > t8Day //if the date hasn't arrived yet stay green
then
set the backgroundColor of fld "fld1" to green
exit mouseup
end if
if fld "fld1" <= t1Day //if date is date or expired turn red
then
set the backgroundColor of fld "fld1" to red
exit mouseUp
end if
if fld "fld1" >= tM7Day //if date is within 7 days of coming due turn yellow
then
set the backgroundColor of fld "fld1" to yellow
exit mouseUp
end if
if fld "fld1" <= tM8Day
then
set the backgroundColor of fld "fld1" to red
exit mouseUp
if fld "fld1" > tM8Day
then
set the backgroundColor of fld "fld1" to green
exit mouseUp
end if