OutputLine
This function is similar to the Output function, but it inserts a line feed character after the result.
This function is convenient when there is a requirement to output multiple functions results from a code block, as each result will be displayed on a separate line, whereas multiple Output functions in a single code block will display each result on the same line.
Argument
OutputLine(1)
Ordinal | Type | Required | Description |
---|---|---|---|
1 | String | True | Evaluated function to display |
NOTE: This function will only return a result from nested functions. It will not return a result if only a variable is used as an argument.
Example
The following example outputs Data Extension fields (for a Subscriber) as separate lines concatenated with a descriptive string:
%%[
var @rows, @row, @firstName, @lastName, @email, @phone
set @rows = LookupRows("Members", "Subscriber Key", _subscriberKey)
set @row = Row(@rows, 1) /* there is only one row per member */
set @firstName = Field(@row, "First Name")
set @lastName = Field(@row, "Last Name")
set @email = Field(@row, "Email")
set @phone = Field(@row, "Phone Number")
OutputLine(Concat("First Name: ", @firstName))
OutputLine(Concat("Last Name: ", @lastName))
OutputLine(Concat("Email: ", @email))
OutputLine(Concat("Phone: ", @phone))
]%%
Output
Each OutputLine result will be displayed on a new line.
First Name: Doug
Last Name: Smith
Email: doug@limedash.com
Phone: 234 235 5678