Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

D toc
Excerpt

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.

D s
snippetBasic

D code
keep row:(customerStatus == 'active')

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.

D s
snippetParameters
D code

keep row:(expression)

TokenRequired?Data TypeDescription
keepYtransformName of the transform
rowYstringExpression identifying the row or rows to keep. If expression evaluates to true for a row, the row is retained.

D s lang notes

row

Include Page
row Parameter
row Parameter

For the 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.

Example:

D code

keep row: (lastOrder >= 10000 && status == 'Active')

Output: Retains all rows in the dataset where the lastOrder value is greater than or equal to 10,000 and the customer status is Active

D s
snippetusage

Required?Data Type
YesExpression that evaluates to true or false


D s
snippetExamples

Example - Remove old products and keep new orders

Include Page
EXAMPLE - Delete and Keep Transforms
EXAMPLE - Delete and Keep Transforms

D s also
labelwrangle_transform_keep