Skip to content

Instantly share code, notes, and snippets.

@wvpv
Last active October 19, 2017 19:06
Show Gist options
  • Save wvpv/7142299846e0ea87daa5 to your computer and use it in GitHub Desktop.
Save wvpv/7142299846e0ea87daa5 to your computer and use it in GitHub Desktop.
SFMC AMScript Lookup multiple column values from a single row
%%[
var @rows, @row, @rowCount
var @lookupValue
set @lookupValue = AttributeValue("lookupField") /* value from attribute or DE column in send context */
set @lookupValue = "whee" /* or a literal value */
set @rows = LookupRows("DataExtensionName","LookupColumn", @lookupValue)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
var @DEColumn1, @DEColumn2
set @row = row(@rows,1) /* get row #1 */
set @DEColumn1 = field(@row,"DEColumn1")
set @DEColumn2 = field(@row,"DEColumn2")
]%%
DEColumn1 is %%=v(@DEColumn1)=%%, DEColumn2 is %%=v(@DEColumn2)=%%
%%[ else ]%%
No rows found
%%[ endif ]%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment