- 1 Minute to read
- Print
- DarkLight
ecx:filterDuplicates
- 1 Minute to read
- Print
- DarkLight
The function ecx:filterDuplicates returns only distinct entries from a target source with duplicate rows filtered out. The value returned is an object type. This function is only useful for non-unique data sets. Data sets with unique keys will not have duplicates.
Example
A related data set named "Q12021" contains purchase records for the first quarter of the year. The key column contains non-unique values. The data set contains a column that identifies the customer who made the purchase called "User ID", which is linked to the user attribute user. Email in Engage. Records from the related data set that corresponds to the recipient's email address are to be displayed in a message. Duplicate records should not be inserted into the message a second time.
The records are inserted into the message using a ForEach loop:
<%ForEach var="item" items="${ecx:filterDuplicates(ecx:related('Q12021','User ID'))}"%> <%item.ProductID%> <%/ForEach%>
In this example, the function ecx:related is used to designate the User ID as the key column in the related data set. The function ecx:filterDuplicates filters for multiple records with identical values. For each recipient with an email address that matches the value in the User ID column, the value in the ProductID column is inserted in the message.
This function only considers a record to be a duplicate when the values in all columns are duplicated. If the related data set in this example contains purchase records for a customer who purchased the same item on two different dates, the product ID for this item would be displayed twice in the message. The record would not be considered a duplicate because the values in the purchase date column are different.
Structure
ecx:filterDuplicates(object)
Parameters
Parameter | Description |
---|---|
object | Specifies the source of the data to filter. |