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 |
---|---|---|---|---|
doug@limedash.com | 8473 | Doug | north | 1 |
suzy@limedash.com | 5497 | Suzy | North | 3 |
dale@limedash.com | 7114 | Dale | West | 2 |
barb@limedash.com | 5767 | Barb | North | 1 |
curt@limedash.com | 5152 | Curt | north | 2 |
nora@limedash.com | 7014 | Nora | South | 1 |
leon@limedash.com | 8225 | Leon | East | 3 |
lily@limedash.com | 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