0

I am attempting to display different content based on a subscribers points balance, with set value ranges.

But the 'less than or equal too' operator <= is causing an error, where the code thinks it's trying to start a new tag.

I've tried to escape the < character with & lt; or & #60; without any luck.

%%[
VAR @giftcardvalue
SET @giftcardvalue = [some data extension variable]
]%%

%%[IF EMPTY(@giftcardvalue) THEN]%%
NULL VALUE RETURNED
%%[ELSEIF @giftcardvalue >= 0 AND @giftcardvalue <= 99 THEN]%%
CODE HERE (0-99)
%%[ELSEIF @giftcardvalue >= 100 AND @giftcardvalue <= 999 THEN]%%
CODE HERE (100-999)
%%[ELSEIF @giftcardvalue >= 1000 AND @giftcardvalue <= 9999 THEN]%%
CODE HERE (1000-9999)
%%[ELSEIF @giftcardvalue >= 10000 THEN]%%
CODE HERE (10000+)
%%[ENDIF]%%

AMPScript Syntax Guide

Help - With thanks!

1 Answer 1

1

I'd wrap your personalization string in the AttributeValue() function to ensure it actually returns an empty string for your conditional. Also, try using Add() function also to ensure it's a number you're comparing:

%%[

var @giftcardvalue
set @giftcardvalue = attributevalue("some data extension variable")

if empty(@giftcardvalue) then

 outputline(concat("null value returned"))

else

  set @giftcardValue = add(@giftcardvalue,0)  

  if @giftcardvalue >= 0 and @giftcardvalue <= 99 then

    outputline(concat("code 0-99"))

  elseif @giftcardvalue >= 1000 and @giftcardvalue <= 9999 then

    outputline(concat("code 1000-9999"))

  elseif @giftcardvalue >= 10000 then

    outputline(concat("code 10000+"))

  endif

endif
]%%

You must log in to answer this question.

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