ExecuteFilter

This function executes the specified Data Extension Data Filter and returns a row set.

NOTE: This function only works in a landing page, microsite page or CloudPage.

NOTE: This function will not work on Profile Attribute Data Filters.

Argument

ExecuteFilter(1)

Ordinal Type Required Description
1 String True Customer/External Key of the Data Filter to execute

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
[email protected] 8473 Doug Smith 2017-10-21 12:01
[email protected] 5497 Suzy Jackson 2017-10-20 11:01
[email protected] 7114 Dale Cameron 2017-10-19 10:01
[email protected] 5767 Barb Brown 2017-10-18 09:01

Data Filter: DataExtension_Test_Sample_Emails

  • Customer/External Key: DataExtension_Test_Sample_Emails
  • Email Address contains limedash.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 [email protected]
Row 2, emailAddress is [email protected]
Row 3, emailAddress is [email protected]