Executes a data filter and returns an unordered rowset that contains the results.
This function only works with data filters that are based on data extensions. You can’t use this function with data filters that are based on profile attributes.
Use this function only on CloudPages, landing pages, microsites, and SMS messages created in MobileConnect.
Availability
Marketing Cloud Engagement
✅ Yes
Marketing Cloud Next
❌ No
Syntax
1ExecuteFilter(dataFilterExternalId)
The ExecuteFilter() function has one parameter:
dataFilterExternalId (string): Required. The external ID of the data filter to execute. This function only works with data filters that are based on data extensions.
Usage
This example uses a data extension called “MembershipRewardsProgramme,” which contains the data in this table.
MemberId
FirstName
Surname
RewardsPoints
RewardsTier
Area
1
Dennis
Smithers
92374
2
Chelsea
2
Pooja
Chatterjee
201042
1
Hammersmith
3
Tomás
Santos
69311
3
Kensington
4
Sun-Hi
Kim
23999
4
Twickenham
5
Jian
Yeh
15123
4
Chelsea
The account also contains a data filter called “MembershipRewardsProgramme_50k points plus,” with an external key of c5a7e0d9-41e0-4068-bdcc-8766d7c1af94. This data filter searches for all values in which the number in the RewardsPoints column is greater than or equal to 50000.
This code example filters the data extension based on the data filter.
1<table>2 <tr>3 <th>Rank</th>4 <th>MemberId</th>5 <th>FirstName</th>6 <th>Surname</th>7 <th>RewardsPoints</th>8 <th>Area</th>9 </tr>10%%[11 Var @rows, @rowCount, @filterExtId12 Set @filterExtId = "c5a7e0d9-41e0-4068-bdcc-8766d7c1af94"13 Set @rows = ExecuteFilter(@filterExtId)14 Set @rowCount = RowCount(@rows)15 If @rowCount > 0 then16 For @counter = 1 to @rowCount do17 Var @row, @rank, @memberId, @firstName, @surname, @rewardsPoints, @rewardsTier, @area18 Set @row = Row(@rows, @counter)19 Set @memberId = Field(@row, "MemberId")20 Set @firstName = Field(@row, "FirstName")21 Set @surname = Field(@row, "Surname")22 Set @rewardsPoints = Field(@row, "RewardsPoints")23 Set @area = Field(@row, "Area")24]%%25 <tr>26 <td>%%=v(@counter)=%%</td>27 <td>%%=v(@memberId)=%%</td>28 <td>%%=v(@firstName)=%%</td>29 <td>%%=v(@surname)=%%</td>30 <td>%%=v(@rewardsPoints)=%%</td>31 <td>%%=v(@area)=%%</td>32 </tr>33%%[34 Next @counter35 EndIf36]%%37</table>
The code example returns a table that contains values from the rowset.