目录

Search

  1. 前言
  2. 使用转换
  3. 汇总器转换
  4. 自定义转换
  5. 自定义转换函数
  6. 数据屏蔽转换
  7. 数据屏蔽示例
  8. 表达式转换
  9. 外部过程转换
  10. 筛选器转换
  11. HTTP 转换
  12. Identity Resolution 转换
  13. Java 转换
  14. Java 转换 API 引用
  15. Java 表达式
  16. Java 转换示例
  17. 联接器转换
  18. 查找转换
  19. 查找缓存
  20. 动态查找缓存
  21. 规范器转换
  22. 等级转换
  23. 路由器转换
  24. 序列生成器转换
  25. 排序器转换
  26. 源限定符转换
  27. SQL 转换
  28. 在映射中使用 SQL 转换
  29. 存储过程转换
  30. 事务控制转换
  31. 联合转换
  32. 非结构化数据转换
  33. 更新策略转换
  34. XML 转换

转换指南

转换指南

“在输入行”选项卡

“在输入行”选项卡

转换收到输入行时,Java 转换会执行“在输入行”选项卡上的 Java 代码。在此示例中,转换可能会也可能不会生成输出行,具体取决于输入行的值。
在“在输入行”选项卡中输入以下代码:
// 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_INP") || isNull ("EMP_NAME_INP")) {      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 port values.      EMP_ID_OUT = EMP_ID_INP;      EMP_NAME_OUT = EMP_NAME_INP; } if (isNull ("EMP_DESC_INP")) {      setNull("EMP_DESC_OUT"); } else {      EMP_DESC_OUT = EMP_DESC_INP; } 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_INP), EMP_NAME_INP); } // Generate row if generateRow is true. if(generateRow)      generateRow();