You have a couple issues with it, but were 90% of the way there. (Assuming you have @firstName
correctly defined above this snippet of course)
%%=iif(empty(@firstName),"Your", concat(propercase(@firstName, "your")))=%%
should be:
%%=iif(empty(@firstName),"Your", concat(propercase(@firstName), ", your"))=%%
The difference being:
1. altering the propercase to only go around @firstName
so that the 'your' does not become capitalized as well.
2. Adding a comma and a space (', ') to your concat string value so it shows John, your
instead of Johnyour
That is pretty much it! Like I said, you were 90% of the way there! Great Job.
I saw your comment on another answer asking about setting FirstName if that does not exist in the Sendable data. See below for best practice to handle this:
SET @firstName = AttributeValue("firstName")
Utilizing AttributeValue will allow a null value for @firstName
if the field does not exist, instead of causing an error like the raw personalization string would (SET @firstName = firstName
)
Final block would be:
%%[
VAR @firstName
SET @firstName = AttributeValue("firstName")
]%%
%%=iif(empty(@firstName),"Your", concat(propercase(@firstName), ", your"))=%%
Assuming firstName field in the sending DE is John
, the output would be:
John, your
and if firstName is empty or field does not exist, output would be:
Your