1

I want to display different content based on a user's point balance in our app. Not sure if I'm doing this correctly. Basically, if they have less than 1,000 points I want to tell them to "report prices" and otherwise, I want to tell them to enter the Gas Card Giveaway.

This is what I have right now:

Hi %%first_name%%! You have %%=FormatNumber(point_balance, "N0", "en-US")=%% points.
[ if %%point_balance%% >=1,000 then ]%%
<a href="%%= RedirectTo(Concat('http://routing.gasbuddy.com/home)) =%%">Report prices</a>%% in GasBuddy today to earn more points!
[ else ]%%
<a href="%%= RedirectTo(Concat('http://routing.gasbuddy.com/home)) =%%">Redeem your points</a>%% and enter the gas card giveaway today.

Does this look correct?

2 Answers 2

1

It's unclear how you intend to display the string http://routing.gasbuddy.com/home)). If for some reason you want to display it as it appears in your code, then you can simplify your AMPscript using the iif() function, so your AMPscript would look like:

Hi %%first_name%%! You have %%=FormatNumber(point_balance, "N0", "en-US")=%% points. http://routing.gasbuddy.com/home)) 

%%=iif(point_balance >=1000,'Report prices in GasBuddy today to earn more points!','Redeem your points and enter the gas card giveaway today.')=%%

If the value of point_balance in your sendable Data Extension is 123.56 then this AMPscript would be rendered as:

Hi Frank! You have 124 points. http://routing.gasbuddy.com/home))

Redeem your points and enter the gas card giveaway today.

If the value of point_balance is 1231.56, then this would be rendered as:

Hi Frank! You have 1,232 points. http://routing.gasbuddy.com/home))

Report prices in GasBuddy today to earn more points!

This doesn't look quite right, but again I'm unsure how you require the string http://routing.gasbuddy.com/home)) to be displayed.

0

You appear to have some syntax issues in your AMPScript and your conditional didn't match what you described.

No need to use the redirectto() and concat() on your static URLs. Link wrapping on will work without it.

I'd write it like this:

%%[

var @first_name, @point_balance
set @first_name = AttributeValue("first_name")
set @point_balance = AttributeValue("point_balance")

]%%

Hi %%=v(@first_name)=%%!  You have <b>%%=format_number(@point_balance, "N0", "en-US")=%%</b> points.

%%[ if @point_balance < 1000 OR empty(@point_balance) then ]%%

<a href="http://routing.gasbuddy.com/home">Report prices</a> in GasBuddy today to earn more points!

%%[ else ]%%

<a href="http://routing.gasbuddy.com/home">Redeem your points</a> and enter the gas card giveaway today.

%%[ endif ]%%

You must log in to answer this question.

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