ExecuteFilter
This function executes the specified Data Extension Data Filter and returns a row set.
Argument
ExecuteFilter(1)
Ordinal | Type | Required | Description |
---|---|---|---|
1 | String | True | Customer/External Key of the Data Filter to execute |
NOTE: This function only works in a landing page, microsite page or CloudPage.
NOTE: This function will not work on Profile Attribute Data Filters.
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 |
barb@plumcomma.com | 5767 | Barb | Brown | 2017-10-18 09:01 |
Data Filter: DataExtension_Test_Sample_Emails
- Customer/External Key:
DataExtension_Test_Sample_Emails
Email Address
containslimedash.com
Here is an example utilizing the preceding context:
%%[
var @rows, @row, @rowCount, @i
set @rows = ExecuteFilter("DataExtension_Test_Example_Emails")
set @rowCount = rowcount(@rows)
if @rowCount > 0 then
output(concat("rowCount: ", @rowCount))
for @i = 1 to @rowCount do
var @emailAddress
set @row = row(@rows, @i) /* get row based on counter */
set @emailAddress = field(@row,"emailAddress")
]%%
<br>Row %%=v(@i)=%%, emailAddress is %%=v(@emailAddress)=%%
%%[
next @i ]%%
%%[ else ]%%
No rows found
%%[ endif ]%%
Output
rowCount: 3
Row 1, emailAddress is doug@limedash.com
Row 2, emailAddress is suzy@limedash.com
Row 3, emailAddress is dale@limedash.com