Blog.
Concat function
This function concatenates one or more attributes which have string as a data type. With this Contact function we can concatenate as many attributes as necessary.
Syntax
Concat (string1, string2, [string3], …)
The Concat()
function has two parameters at least:
string1
(string): Required. A string of text.string2
(string): Required.
Usage
This function requires two strings in minimum. Strings are concatenated sequentially. This function creates a full name from a first, middle, and last name. You must explicitly include space characters in the function to incorporate spaces between strings.
%%[ Var @firstName, @middleName, @lastName, @fullName Set @firstName = “Kjell” Set @middleName = “Jakob” Set @lastName = “Larssen” Set @fullName = Concat(@firstName, ” “, @middleName, ” “, @lastName) ]%% <p>Full name: %%=v(@fullName)=%%</p>
The function outputs the full name.
Full name: Kjell Jakob Larssen
Example 1
%%[ VAR @fullName
SET @fullName = Concat(AttributeValue(“FirstName”), ” “, AttributeValue(“LastName”)) ]%%
Hello %%=v(@fullName)=%%
The AttributeValue
function is used to retrieve the subscriber’s FirstName, LastName from a sendable data extension
Example 2
%%[
var @firstName
var @lastName
var @fullName
set @firstName = AttributeValue(“firstName”) /* value from attribute or DE column in send context / set @firstName = “Cornelia” / or a literal value */
set @lastName = AttributeValue(“lastName”) /* value from attribute or DE column in send context / set @lastName = “Balma” / or a literal value */
set @fullName = Concat(@firstName, ” “, @lastName)
]%%
firstName: %%=v(@firstName)=%%
lastName: %%=v(@lastName)=%%
fullName: %%=v(@fullName)=%%
Output
firstName: Cornelia lastName: Balma fullName: Cornelia Balma