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. Deduplicate transformation
  9. Expression transformation
  10. Filter transformation
  11. Hierarchy Builder transformation
  12. Hierarchy Parser transformation
  13. Hierarchy Processor transformation
  14. Input transformation
  15. Java transformation
  16. Java transformation API reference
  17. Joiner transformation
  18. Labeler transformation
  19. Lookup transformation
  20. Mapplet transformation
  21. Normalizer transformation
  22. Output transformation
  23. Parse transformation
  24. Python transformation
  25. Rank transformation
  26. Router transformation
  27. Rule Specification transformation
  28. Sequence Generator transformation
  29. Sorter transformation
  30. SQL transformation
  31. Structure Parser transformation
  32. Transaction Control transformation
  33. Union transformation
  34. Velocity transformation
  35. Verifier transformation
  36. Web Services transformation

Transformations

Transformations

Filter configuration example

Filter configuration example

You might 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.
For example, you are converting 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. The array must contain the product details that 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'
When you do this, 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" } ] }