Output Function

The Output function is used with other AMPscript functions like the V function where it returns the results of AMPscript code, but within a code block. Must use an AMPscript function within the Output function such as the Concat function.

Example:

For example, if you want to output within an AMPscript code block:

					

%%[ var @output
Set @output = ‘My output’
Output(v(@output)) ]%%

Output:

My Output

Explanation:

In this example, we have one AMPscript code block and can output the variable @output without having to close the AMPscript block. An example using a standalone V Function, the AMPscript block must be closed.

Note that you can replace the V Function with any other AMPscript function. A few more examples below:

More Examples:

A few more examples using the Output Function and the expected output.

					

%%[ var @output
Set @output = ‘1’
Output(Add(@output, 1)) ]%%

Output:

2

Using the Concat function

					

%%[ var @output
Set @output = ‘hello ‘
Output(Concat(@output, “there”)) ]%%

Output:

hello there

Leave a Reply

Your email address will not be published. Required fields are marked *