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

On Input Row

On Input Row

The Java transformation executes the Java code in the On Input Row section when the transformation receives an input row. In this example, the transformation might or might not generate an output row, based on the values of the input row.
Enter the following code in the On Input Row section:
// Initially set generateRow to true for each input row. generateRow = true; // Initially set isRoot to false for each input row. isRoot = false; // Check if input employee id and name is null. if (isNull ("EMP_ID") || isNull ("EMP_NAME")) { incrementErrorCount(1); // If input employee id and/or name is null, don't generate a output row for this // input row. generateRow = false; } else { // Set the output field values. EMP_ID_OUT = EMP_ID; EMP_NAME_OUT = EMP_NAME; } if (isNull ("EMP_DESC")) { setNull("EMP_DESC_OUT"); } else { EMP_DESC_OUT = EMP_DESC; } boolean isParentEmpIdNull = isNull("EMP_PARENT_EMPID"); if(isParentEmpIdNull) { // This employee is the root for the hierarchy. isRoot = true; logInfo("This is the root for this hierarchy."); setNull("EMP_PARENT_EMPNAME"); } synchronized(lock) { // If the employee is not the root for this hierarchy, get the corresponding // parent ID. if(!isParentEmpIdNull) EMP_PARENT_EMPNAME = (String) (empMap.get(new Integer (EMP_PARENT_EMPID))); // Add employee to the map for future reference. empMap.put (new Integer(EMP_ID), EMP_NAME); } // Generate row if generateRow is true. if(generateRow) generateRow();

0 COMMENTS

We’d like to hear from you!