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

Sequence Generator transformation example

Sequence Generator transformation example

The following example shows how you can use the Sequence Generator 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 Generator transformation to create customer IDs, using the following process:
  1. You 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 target file includes a column for the cust_id field with no values.
  2. You create a connection that has access to the CustomerData.csv and CustomerData_IDs.csv files.
  3. You 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. You add a Sequence Generator transformation to the mapping.
    On the transformations palette, the Sequence Generator transformation is labeled "Sequence."
  5. You want a simple sequence starting with 1, so on the Sequence tab, you set the
    Initial Value
    to 1 and the
    Increment By
    value to 1. This setting 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.
  6. You add a Target transformation to the mapping and configure the transformation to use the CustomerData_IDs.csv file that you created.
  7. You connect the Source transformation to the Sequence Generator transformation and the Sequence Generator transformation to the Target transformation:
    The mapping canvas shows the Source transformation connected to the Sequence Generator transformation and the Sequence Generator transformation connected to the Target transformation.
  8. In the Target transformation, you 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. You save the mapping and create a
    mapping
    task in the
    mapping
    task wizard. The
    Current Value
    is 1 because you have not run the mapping 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 you run the
    mapping
    task, you 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. You 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 Generator transformation.

0 COMMENTS

We’d like to hear from you!