0

I'm trying to run an AMPScript in my emails where I'll be able to link in some meta data on my subscribers.

I'd like to utilize when they signed up as a point to discern if the subscriber is new, old, or very old.

Here's the script that I wrote, but it is not accepted.

 VAR @Registrationdate

 SET @Registrationdate = [Registration Date]

  VAR @membertag

 IF @Registrationdate < 'NOW()-60' THEN SET   
  @membertag = 'very-old'

 ELSEIF @Registrationdate < 'NOW()-30' THEN SET   
  @membertag = 'old'

 ELSE SET
  @membertag = 'new'

 ENDIF 

Any help would be greatly appreciated.

Thank you,

Shmuel

0

1 Answer 1

4

The quotes around NOW()-60 and NOW()-30 are causing that code to be read as a text string.

The DateAdd() AMPscript function can be used to calculate your dates, by using negative numeric values to subtract the days from the current date.

%%[

VAR @Registrationdate, @membertag
set @Registrationdate = [Registration Date]

IF @Registrationdate < DateAdd(NOW(), '-60','D') THEN 
  set @membertag = 'very-old'
ELSEIF @Registrationdate < DateAdd(NOW(), '-30','D') THEN
  set @membertag = 'old'
ELSE 
  set @membertag = 'new'
ENDIF 

]%%

If any of the dates are saved as strings, then the DateParse() function should be utilized to ensure a date object is being evaluated, instead of just a string.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .