0

We are building an email that has a concert ticket with a name box that pulls in firstname and surname.

My issue is:

I need to have it read "VIP MEMBER" for any firstname and surname that are less than 2 characters or more than 13.

However I cant seem to find a way that if the customer was firstname=G and lastname=Minshall it will display "VIP MINSHALL" or firstname=Graeme and lastname=M it will display "GRAEME MEMBER".

I wanted to try and concatenate the two fields and count the amount of charachter's then default to "VIP MEMBER" for any user that fall outs of the criteria.

My current code is below:

%%[
var @lname
var @fname
set @lname=Surname
set @fname=Firstname
set @lname=UPPERCASE(@lname)
set @fname=UPPERCASE(@fname)
IF (Length(@lname)>13)then
    set @lname="MEMBER"
ELSEIF (Length(@lname)<2)then
    set @lname="MEMBER"
ENDIF

IF (Length(@fname)>13)then
    set @fname="VIP"
ELSEIF (Length(@fname)<2)then
    set @fname="VIP"
ENDIF
]%%

In the email content ticket area I'm putting %%= v(@fname) =%% %%= v(@lname) =%% in the ticket name box.

Any help on how to achieve the above is appreciated.

1
  • Thanks for the edit Jesse it would not let me paste it in that way.
    – G.Minshall
    Commented Aug 15, 2016 at 16:07

1 Answer 1

0

Something like this maybe?

%%[

set @fname = uppercase(AttributeValue("Firstname"))
set @lname = uppercase(AttributeValue("Surname"))

set @fname = uppercase("G")
set @lname = uppercase("Minshall")

output(concat("input: ",@fname," ",@lname))

IF length(@lname) > 13 or length(@lname) < 2 or length(@fname) > 13 or length(@fname) < 2 then
  set @fname = "VIP"
  set @lname = "MEMBER"
ENDIF

output(concat("<br>output: ",@fname," ",@lname))

set @fname = uppercase("Graeme")
set @lname = uppercase("M")

output(concat("<br><br>input: ",@fname," ",@lname))

IF length(@lname) > 13 or length(@lname) < 2 or length(@fname) > 13 or length(@fname) < 2 then
  set @fname = "VIP"
  set @lname = "MEMBER"
ENDIF

output(concat("<br>output: ",@fname," ",@lname))

set @fname = uppercase("Adam")
set @lname = uppercase("Spriggs")

output(concat("<br><br>input: ",@fname," ",@lname))

IF length(@lname) > 13 or length(@lname) < 2 or length(@fname) > 13 or length(@fname) < 2 then
  set @fname = "VIP"
  set @lname = "MEMBER"
ENDIF

output(concat("<br>output: ",@fname," ",@lname))

]%%

Output

input: G MINSHALL 
output: VIP MEMBER 

input: GRAEME M 
output: VIP MEMBER 

input: ADAM SPRIGGS 
output: ADAM SPRIGGS 
0

You must log in to answer this question.

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