LookupRowsCS

This function returns a set of unordered rows from a Data Extension. This variation of the LookupRows function treats selection values as case-sensitive.

Arguments

LookupRowsCS(1,2,3,[4a,4b]...)

Ordinal Type Required Description
1 String True Name of the Data Extension from which to return rows
2 String True Name of the column that identifies the rows to retrieve
3 String True Value that identifies the rows to retrieve
4a String False Additional column name that identifies the rows to retrieve (see note)
4b String False Additional value that identifies the rows to retrieve (see note)

NOTE: Additional pairs of columns and values can be appended as arguments.

Example 1

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
Region Text 50 N Y
Rank Number N Y

The LoyaltyMembers Data Extension includes these rows:

EmailAddress SubscriberKey FirstName Region Rank
[email protected] 8473 Doug north 1
[email protected] 5497 Suzy North 3
[email protected] 7114 Dale West 2
[email protected] 5767 Barb North 1
[email protected] 5152 Curt north 2
[email protected] 7014 Nora South 1
[email protected] 8225 Leon East 3
[email protected] 9496 Lily East 1

Here is an example utilizing the preceding context:

%%[
var @rows, @row, @rowCount, @region, @i

set @region = AttributeValue("Region") /* value from attribute or DE column in send context */
set @region = "north" /* or a literal value */
set @rows = LookupRowsCS("LoyaltyMembers","region", @region)
set @rowCount = rowcount(@rows)

output(concat("region: ", @region))

if @rowCount > 0 then

  for @i = 1 to @rowCount do

    var @emailAddress, @firstName, @rank
    set @row = row(@rows, @i) /* get row based on counter */
    set @firstName = field(@row,"firstName")
    set @emailAddress = field(@row,"emailAddress")

    ]%%

    <br>Row %%=v(@i)=%%, firstName: %%=v(@firstName)=%%, emailAddress: %%=v(@emailAddress)=%%

    %%[

  next @i ]%%

%%[ else ]%%

No rows found

%%[ endif ]%%

Output

region: north
Row 1, firstName: Doug, emailAddress: [email protected]
Row 2, firstName: Curt, emailAddress: [email protected]

Example 2


Not a subscriber? Subscribe now.