RowCount

This function returns the number of rows in a row set.

Argument

RowCount(1)

Ordinal Type Required Description
1 String Y Row set from which to return the count

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
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
var @region
set @region = "North"

set @rows = LookupRows("LoyaltyMembers","Region", @region)
set @rowCount = rowcount(@rows)

]%%
rowCount: %%=v(@rowCount)=%%

Output

rowCount: 4