if

Perform an action on a data extract if a condition is false.

Introduction

Use the if enrichment to perform an action on the data extract if the condition of an expression is false. Use the Complement field to reverse the condition so the action is performed if the expression is true.

The actions available include raising errors, notifying users and removing data. Enter the expression as a Python expression. For more information on what you can enter as a python expression, see Using Python expressions in custom scripts.

Creating the enrichment

For more information on creating an enrichment, see Using custom scripts.

Configuring the enrichment

To configure the enrichment, fill in the following fields. Required fields are marked with an asterisk (*).

Condition*

Enter a python expression. If the outcome of the expression is false, an action is applied to the data extract. For more information on what you can enter as a python expression, see Using Python expressions in custom scripts.

Action

Select one of the following actions:

Remove

If the expression is false, the entire data extract is removed.

Raise

If the expression is false, an error is added to the transformation logs and a message is displayed on screen.

Notify

If the expression is false, an error is sent to the user as a notification. This notification is sent to users that are subscribed to the Transformation Error topic. For more information on notifications, see Setting up notifications.

Break

If the expression is false, the data extract is split. All rows above the row where the expression equals false are kept, and the remaining rows in the data extract are removed.

Message

Enter the message to display or notify users when the condition is met.

Complement

Select this field to reverse the expression and the action is taken if the expression is true.

Subtable

Enter the name for a subtable that you want to contain the enriched data. The enrichment is applied to the whole data extract, then the enriched data is output into the subtable you have named here.

This subtable is a temporary table, which means it only exists for this custom script. You can apply additional instructions within the same custom script to the subtable. However, the subtable cannot be used in any other custom scripts.

Example

To notify users if there have been no conversions in a data extract, use the following enrichment configuration for the if enrichment.

Enrichment configuration

Condition

{total_conversion} == '0'

Action

notify

Message

'There have been no conversions'

Complement

Select this field to ensure the notification is sent. As the enrichment runs when the if statement is FALSE, the Complement field needs to be selected so that when the condition is TRUE, it is reversed to FALSE.