Quote:
Originally Posted by ownedbycats
I've got it.
Code:
program:
arguments(date, colourA, colourB, colourC);
now = format_date(today(), 'yyyy-MM-dd');
if days_between(now,date) <= '1' then colourA
elif days_between(now,date) <= '7' then colourB
elif days_between(now,date) <= '14' then colourC fi
|
As you know that days_between() returns a number, I suggest you use numeric comparisons. That will avoid problems caused by the order of the tests. For example, using string comparisons '14' is less than '7'.
Try this:
Code:
program:
arguments(date, colourA, colourB, colourC);
now = format_date(today(), 'yyyy-MM-dd');
days = days_between(now,date);
if days <=# 1 then colourA
elif days <=# 7 then colourB
elif days <=# 14 then colourC fi