0

I am writing an IF statement for subscribers that do not have a first name:

%%[IF Not Empty(First_Name) THEN]%%
%%=Concat(ProperCase(First_Name)," ",you)=%%
%%[ELSE]%%You%%[ENDIF]%%

I am getting an error that I cannot resolve:

An error occurred when attempting to resolve a function call. See inner exception for detail. Function Call: Concat(ProperCase(First_Name)," ",@u) Index: 2594 Content Type: Text Substitution Level: Subscriber Message Context: SMSPreview

Has anyone seen this or know how to resolve it?

2 Answers 2

1

If Firstname is an Subscriber Attribute I believe that you can write First_Name in the code but i would usually recommend a different way. You set the " at wrong places when you used concat. When you want to combine static strings it is always Concat("Text1","Text2") or Concat('Text1',"Text"). When using variables you would write it without " and use the variable like @text.

%%[
var @First_Name 
set @First_Name = AttributeValue(First_Name)

IF Not Empty(@First_Name) THEN
]%%

  %%=Concat(ProperCase(@First_Name)," ,you ")=%%

%%[
ELSE
]%%

  You

%%[
ENDIF
]%%

I would write it different:

%%[
var @First_Name, @output
set @First_Name = AttributeValue(First_Name)


IF Not Empty(@First_Name) THEN
  set @output = Concat(ProperCase(@First_Name)," ,you ")=%%
ELSE
  set @output = "You"
ENDIF
]%%

%%=v(@output)=%%
2
  • Thank you, I will try this, First_name is an attribute within the journey audience, that variable is working correctly, its the blank space that is creating the issues, I believe. Commented Oct 31, 2019 at 13:48
  • Its your " that is set wrong which causes your script to fail inside the concat function. Commented Oct 31, 2019 at 13:52
0

I tried this -- in order to make it work, I needed to wrap AttributeValue in ""

    set @name = AttributeValue("First Name") 

doesn't work, but

    set @name = AttributeValue("First Name") 

does. This was driving me NUTS, I thought the space in the AttributeValue name was breaking the assignment.

You must log in to answer this question.

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