Table of Contents

Search

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

Transformations

Transformations

Sequence transformation example

Sequence transformation example

The following example shows how you can use the Sequence transformation to generate primary keys.
You are gathering customer data and need to assign customer IDs to each customer. The CustomerData.csv flat file contains your source customer data. You create a mapping that includes the Sequence transformation to create customer IDs, using the following process:
  1. Create a copy of the CustomerData.csv file to use as the target and then add the cust_id field to the file to hold the generated customer ID values. You name the file CustomerData_IDs.csv. The following image shows a sample of the file:
    The target file includes a column for the cust_id field with no values.
  2. Create a connection that has access to the CustomerData.csv and CustomerData_IDs.csv files.
  3. Create a mapping in the Mapping Designer and add a Source transformation to the mapping. You configure the transformation to use the CustomerData.csv file.
  4. Add a Sequence transformation to the mapping.
  5. To generate a simple sequence starting with 1, set the
    Initial Value
    to 1 and the
    Increment By
    value to 1. This configuration starts the sequence at 1 and increments the value by 1, for example, 1, 2, 3.
    You leave the default values for the other properties. The following image shows this configuration:
  6. Add a Target transformation to the mapping and configure the transformation to use the CustomerData_IDs.csv file that you created.
  7. Connect the Source transformation to the Sequence transformation and the Sequence transformation to the Target transformation:
    The mapping canvas shows the Source transformation connected to the Sequence transformation and the Sequence transformation connected to the Target transformation.
  8. In the Target transformation, map the NEXTVAL output field to the cust_id field.
    The Field Mapping tab shows the NEXTVAL output field mapped to the cust_id field.
  9. Save the mapping and create a
    mapping
    task in the
    mapping
    task wizard. The
    Current Value
    is 1 because the mapping hasn't been run yet and the
    Initial Value
    is 1.
    The Sequences section in the mapping task detail shows that the current value is 10001 and the Initial Value is 1.
  10. After running the
    mapping
    task, view the
    mapping
    task details. The task details show the current value and the initial value of the sequence.
    The mapping task details show the current value and the initial value for the sequence.
  11. Open the CustomerData_IDs.csv file and note that the cust_id field is populated with a numeric sequence:
    The target CustomerDataIDs.csv file includes a column for the cust_id field which is populated with values generated by the Sequence transformation.

0 COMMENTS

We’d like to hear from you!