0

I have a data extension attribute called MemberTier and the value can be one of 3 possibilities, S,G,P, or Silver, Gold, Platinum.

I want to take the abbreviation and translate that into the full name in the body of the email but I'm stuck. I've looked on other forums and I feel like this is right but I'm getting a ton of validation errors. Here's what I have:

%%[
set @MemberTier = MemberTier

IF @MemberTier == "S" THEN
 set @Tier = "Silver"
ELSEIF  @MemberTier == "G" THEN
 set @Tier = "Gold"
ELSEIF  @MemberTier == "P" THEN
 set @Tier = "Platinum"
ENDIF
]%%

%%=v(@Tier)=%%
2
  • 1
    what are your validation errors, they may not be related to this code
    – EazyE
    Commented Jan 22, 2022 at 23:47
  • you're right, the validation errors had nothing to do with this.
    – PForsyth
    Commented Jan 23, 2022 at 3:19

2 Answers 2

2

I'll guess and say your send context doesn't include MemberTier.

I'm on team "no naked personalization strings" (aka don't assume your send context variables exist, check them with AttributeValue):

%%[

set @debug = 1
set @MemberTier = AttributeValue("MemberTier")

if @debug == 1 then
  output(concat("<br>memberTier: ", @memberTier))
endif

if empty(@MemberTier) then 

  set @Tier = "Unknown"

  IF @MemberTier == "S" THEN
   set @Tier = "Silver"
  ELSEIF @MemberTier == "G" THEN
   set @Tier = "Gold"
  ELSEIF @MemberTier == "P" THEN
   set @Tier = "Platinum"
  ENDIF

else
  raiseError("MemberTier doesn't exist or is empty", 1)
endif

]%%
%%=v(@Tier)=%%

Also, I'd suggest adding a default value for Tier since you have no catch-all else in your conditional.

2
  • the MemberTier is an attribute in the data extension I'm sending to, and a member will only be a S, G or P Tier.
    – PForsyth
    Commented Jan 23, 2022 at 3:20
  • I'm also wondering, my %%=v(@Tier)=%% variable is nested within another personalization string and I know that's not always ideal.
    – PForsyth
    Commented Jan 24, 2022 at 13:45
0

Figured it out. the %%=v(@Tier)=%% was in a pre-existing personalization string so once I edited the variable to simply @Tier, it worked as expected. thanks!

You must log in to answer this question.

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