Row
This function returns a specific row from a row set.
Arguments
Row(1,2)
Ordinal | Type | Required | Description |
---|---|---|---|
1 | String | Y | Row set from which to return the row |
2 | Number | Y | Position of element to retrieve from the row set |
Example
Data Extension: LoyaltyMembers
Name | Data Type | Length | Primary Key | Nullable | Default Value |
---|---|---|---|---|---|
EmailAddress | EmailAddress | 254 | N | N | |
SubscriberKey | Text | 254 | Y | N | |
FirstName | Text | 50 | N | Y | |
LastName | Text | 50 | N | Y | |
Created | Date | N | Y | Current Date |
The LoyaltyMembers Data Extension includes these rows:
EmailAddress | SubscriberKey | FirstName | LastName | Created |
---|---|---|---|---|
doug@limedash.com | 8473 | Doug | Smith | 2017-10-21 12:01 |
suzy@limedash.com | 5497 | Suzy | Jackson | 2017-10-20 11:01 |
dale@limedash.com | 7114 | Dale | Cameron | 2017-10-19 10:01 |
Here is an example utilizing the preceding context:
%%[
var @rows, @row, @rowCount
var @emailAddress
set @emailAddress = AttributeValue("emailaddr") /* value from attribute or DE column in send context */
set @emailAddress = "dale@limedash.com" /* or a literal value */
set @rows = LookupRows("LoyaltyMembers","EmailAddress", @emailAddress)
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
var @firstName, @lastName
set @row = row(@rows,1) /* get row #1 */
set @firstName = field(@row,"firstName")
set @lastName = field(@row,"lastName")
]%%
firstName: %%=v(@firstName)=%%, lastName: %%=v(@lastName)=%%
%%[ else ]%%
No rows found
%%[ endif ]%%
Output
firstName: Dale, lastName: Cameron