Registered users of this product or Trifacta Wrangler Enterprise should login to Product Docs through the application.
Retains a set of rows in your dataset, which are specified by the conditional in the
row expression. All other rows are removed from the dataset. The
keep transform is the opposite of the
delete transform. See Delete Transform.
Output: For each row in the dataset, if the value of the
customerStatus column is
active, then the row is retained. Otherwise, the row is deleted from the dataset.
|Parameter||Required?||Transform Builder||Data Type||Description|
|row||Y||Condition||string||Expression identifying the row or rows to keep. If expression evaluates to |
For more information on syntax standards, see Language Documentation Syntax Notes.
Expression to identify the row or rows on which to perform the transform. Expression must evaluate to
keep transform, if the expression for the
row parameter evaluates to
true for a row, it is kept in the dataset. Otherwise, it is removed.
Output: Retains all rows in the dataset where the
lastOrder value is greater than or equal to 10,000 and the customer status is
|Yes||Expression that evaluates to |
Example - Remove old products and keep new orders
This examples illustrates how you can keep and delete rows from your dataset using the following transforms:
delete- Deletes a set of rows as evaluated by the conditional expression in the
rowparameter. See Delete Transform.
keep- Retains a set of rows as evaluated by the conditional expression in the
rowparameter. All other rows are deleted from the dataset. See Keep Transform.
Your dataset includes the following order information. You want to edit your dataset so that:
- All orders for products that are no longer available are removed. These include the following product IDs:
- All orders that were placed within the last 90 days are retained.
First, you remove the orders for old products. Since the set of products is relatively small, you can start first by adding the following:
NOTE: Just preview this transform. Do not add it to your recipe yet.
When this step is previewed, you should notice that the top row in the above table is highlighted for removal. Notice how the transform relies on the
ProdIdvalue. If you look at the
ProductNamevalue, you might notice that there is a misspelling in one of the affected rows, so that column is not a good one for comparison purposes.
You can add the other product IDs to the transform in the following expansion of the transform, in which any row that has a matching
ProdId value is removed:
Now, you can filter out of the dataset orders that are older than 90 days. First, add a column with today's date:Keep the rows that are within 90 days of this date using the following: Don't forget to drop the
todaycolumn, which is no longer needed: Results:
This page has no comments.