Output
While code within an AMPscript block does not display output where the block appears in an email on a page, the Output function enables variable values to be output at the location where the code block appears.
This function is convenient when debugging AMPscript, as it enables variables or function values to be output in an email, message or page, without the requirement to output the code in an inline AMPscript function.
Argument
Output(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. For example
Output(@firstName)
will not output a value, even if the variable has been set within the code block.
Example 1
The following example outputs a @firstName
variable from a Data Extension field, concatenated with a descriptive string:
%%[
var @firstName
set @firstName = Lookup("Members", "First Name", "Email", emailaddr)
Output(Concat("First Name: ", @firstName))
]%%
Output
A field value of Nora
will return the following output:
First Name: Nora
Example 2
Not a subscriber? Subscribe now.