The Enrichment activity is an advanced activity that allows you to define additional data to process in your workflow.
The Enrichment activity is generally used following targeting activities or after importing a file and before activities that allow the use of targeted data.
This activity contains more advanced enrichment functions than the Query activity. Some simple cases of enrichment can be directly performed in the Query activity.
With the Enrichment activity, you can leverage the inbound transition and configure the activity to complete the output transition with additional data. It allows to combine data coming from multiple sets, or to create links to a temporary resource.
If the activity has several inbound transitions, select the Primary set . The additional data configured in this activity will be added to this primary set in the outbound transition.
If there are several inbound transitions, define relations between the primary set and the other inbound data in the Advanced Relations tab of the activity. You can add several relations using the Add element button.
When defining a new relation, select the set of inbound data that you want to link to the primary set. Then define the type of relation. Several types of relations are available, depending on the inbound data and your data model:
Once the Cardinality is defined, define a Reconciliation criteria . The Source expression of the reconciliation criteria can be a field from the target resource, an expression or directly a value specified between quotes.
You can only define relations between the primary set and the other inbound transitions connected to the Enrichment activity. For simpler cases aiming at defining relations with database resources, use a Reconciliation activity.
Define the additional data from the Additional data tab of the activity. You can define additional data (simple fields, aggregates and collections) related to the targeting dimension of the primary set or based on the links created in the Advanced relations tab of the Enrichment activity.
Consult the Enriching data section.
The data is now available to use in the activities connected after the Enrichment . For example, you can find it under the Additional data (targetData) link of the personalization fields explorer in an email content.
This example shows how to enrich profile data with purchase data contained in a file. We consider here that the purchase data are stored in a third-party system. Each profile can have several purchases stored in the file. The final goal of the workflow is to send an email to the target profiles who have purchased at least two items to thank them for their loyalty.
tcode;tdate;customer;product;tamount aze123;21/05/2017;email@example.com;TV;799 aze124;28/05/2017;firstname.lastname@example.org;Headphones;8 aze125;31/07/2017;email@example.com;Headphones;8 aze126;14/12/2017;firstname.lastname@example.org;Plastic Cover;4 aze127;02/01/2018;email@example.com;Case Cover;79 aze128;04/03/2017;firstname.lastname@example.org;Phone;149
With this example file, we will use the email address to reconcile the data with the database profiles. You can also enable unique IDs as described in this document.
An Enrichment activity that creates a link between the transaction data loaded from the file and the profiles selected in the Query . The link is defined in the Advanced relations tab of the activity. The link is based on the transition coming from the Load file activity. It uses the "email" field of the profile resource and the "customer" column of the imported file as reconciliation criteria.
A collection of two lines corresponding to the two last transactions of each profile. For this collection, the product name, the transaction date, and the price of the product are added as additional data. A descending sort is applied on the data. To create the collection, from the Additional data tab:
Check Collection and specify the number of lines to retrieve (2 in this example). In this screen, you can customize the Alias and the Label of the collection. These values will be visible in the following activities of the workflow when referring to this collection.
An aggregate counting the total number of transactions for each profile. This aggregate will be used later to filter profiles that have at least two transactions recorded. To create the aggregate, from the Additional data tab:
As Data to keep, define a Count All aggregate. If you need, specify a custom alias to find it faster in the following activities.