Table of Contents

Search

  1. Preface
  2. Transformations
  3. Source transformation
  4. Target transformation
  5. Aggregator transformation
  6. Cleanse transformation
  7. Data Masking transformation
  8. Data Services transformation
  9. Deduplicate transformation
  10. Expression transformation
  11. Filter transformation
  12. Hierarchy Builder transformation
  13. Hierarchy Parser transformation
  14. Hierarchy Processor transformation
  15. Input transformation
  16. Java transformation
  17. Java transformation API reference
  18. Joiner transformation
  19. Labeler transformation
  20. Lookup transformation
  21. Machine Learning transformation
  22. Mapplet transformation
  23. Normalizer transformation
  24. Output transformation
  25. Parse transformation
  26. Python transformation
  27. Rank transformation
  28. Router transformation
  29. Rule Specification transformation
  30. Sequence Generator transformation
  31. Sorter transformation
  32. SQL transformation
  33. Structure Parser transformation
  34. Transaction Control transformation
  35. Union transformation
  36. Velocity transformation
  37. Verifier transformation
  38. Web Services transformation

Transformations

Transformations

Configure filter conditions

Configure filter conditions

You can define filter conditions to project a subset of the input data in the Hierarchy Processor transformation. You can filter based on incoming fields or output fields.
You can configure a filter condition to read data from primitive fields into an output array or struct field when the data in the array or struct field must correspond to the data in a sibling field in the output group.

Filter configuration example

You want to convert relational data to a JSON file. The incoming data is in a relational table that contains orders information. The orders table contains multiple rows for each order because each order can contain several products.
The incoming data looks like the following data:
OrderNumber,ProductName,ProductType,NumberOfItems,PricePerItem 12345,M&Ms Candies Chocolate Peanut Party Size - 38 Oz,Candy,2,14.49 12345,Stella Parm Shredded Cup - 20 Oz,Dairy,1,10.99 12345,AHA Sparkling Water Blueberry Pomegranate - 8-12 Fl. Oz.,Beverages,1,3.33 23456,Weetabix Biscuit Cereal Whole Grain 2 Count - 14 Oz,Breakfast & Cereal,2,4.99 23456,Producers Milk Lowfat 1% - Half Gallon,Dairy,1,2.79 23456,Egglands Best Eggs Cage Free Large Brown - 12 Count,Eggs,1,4.99
You want to read the product details into an array, where the product details are associated with a particular order number.
The following image shows the structure of the incoming and output fields:
The image shows the Hierarchy Processor tab of the Hierarchy Processor transformation. The Incoming Fields panel contains one input group with the following fields: OrderNumber, ProductName, ProductType, NumberOfItems, and PricePerItem. The Output Fields panel contains one output group with the following fields: OrderNumber (string) and ProductDetails (array). The ProductDetals array contains the following fields: ProductName, ProductType, NumberOfItems, and PricePerItem.
In the Output Fields panel, set the data source for the Output group to
Input
, and configure the group by field as
Input.OrderNumber
to remove duplicate records from the output. Set the data source for the ProductDetails array to
Input
.
To ensure that the details in the ProductDetails array correspond to the order number in the output, configure the following filter condition for the array:
:fld.{Input.OrderNumber}= :fld.{Output.OrderNumber}
To further refine the records, use an AND condition in the filter. For example, to exclude records in which the product type is "Candy," configure the following filter condition:
:fld.{Input.OrderNumber}= :fld.{Output.OrderNumber} AND :fld.{Input.ProductType} != 'Candy'
The output contains one record for each order, and incoming records with the product type "Candy" are excluded.
The output data contains the following records:
{ "OrderNumber":"12345", "ProductDetails":[ { "ProductName":"AHA Sparkling Water Blueberry Pomegranate - 8-12 Fl. Oz.", "ProductType":"Beverages", "NumberOfItems":"1", "PricePerItem":"3.33" }, { "ProductName":"Stella Parm Shredded Cup - 20 Oz", "ProductType":"Dairy", "NumberOfItems":"1", "PricePerItem":"10.99" } ] } { "OrderNumber":"23456", "ProductDetails":[ { "ProductName":"Egglands Best Eggs Cage Free Large Brown - 12 Count", "ProductType":"Eggs", "NumberOfItems":"1", "PricePerItem":"4.99" }, { "ProductName":"Producers Milk Lowfat 1% - Half Gallon", "ProductType":"Dairy", "NumberOfItems":"1", "PricePerItem":"2.79" }, { "ProductName":"Weetabix Biscuit Cereal Whole Grain 2 Count - 14 Oz", "ProductType":"Breakfast & Cereal", "NumberOfItems":"2", "PricePerItem":"4.99" } ] }

0 COMMENTS

We’d like to hear from you!