ifdate
Use the "ifdate" command in situations where you simply want to know whether a date field is within a certain range of date values.
The ifdate
syntax is:
%%
ifdate tablename.datefield
yyyy/mm/dd yyyy/mm/dd "content1"
yyyy/mm/dd yyyy/mm/dd "content2"
. . .
%%
How it works: for each individual recipient, the command looks in the table tablename
for the field datefield
. If the field's date value is between the first condition's two date values
(in the format yyyy/mm/dd), the command prints content1
and ends the script. If the field's
date value is between the second condition's two date values, the command prints content2
, and
so on. (You can have as many date--content groupings as you like -- but make sure each value has a
content result.) If the field is not equal to any of the values, the script prints defaultcontent
.
Example 1
You want to insert an introductory line in your monthly text newsletter thanking customers who joined your list recently or long ago.
Newsletter for July 1, 2002
%%
.
ifdate members_.DateJoined_
2002/06/01 2002/07/01
1995/01/ 1999/12/31
"
%%Dear..
A line break is inserted after the special message, so that the thank you would appear on a line of its own.
Joe, who joined in the last month, would see:
Newsletter for July 1, 2002
WELCOME NEW CUSTOMERS!
Dear...
Dennis, who joined in 1998, would see:
Newsletter for July 1, 2002
THANKS VETERAN CUSTOMERS!
Dear...
Tenzing, who joined in 2000, would see:
Newsletter for July 1, 2002
Dear...