tMapの例
以下のtMapの例では、次のことを行っています。
- データ型の自動変換を有効にする
- 出力スキーマを定義する
- メイン入力テーブルとルックアップテーブルを定義し、さらに両者間に内部結合を設定する
- 変数テーブルを定義する
- 入力テーブル、変数テーブル、出力テーブル間のマッピングを定義する
- データ変換を定義する
addComponent {
setComponentDefinition {
TYPE: "tMap",
NAME: "tMap_1",
POSITION: 512, 160
}
setSettings {,
ENABLE_AUTO_CONVERT_TYPE : "true"
}
addSchema {
NAME: "out1",
CONNECTOR: "FLOW",
LABEL: "out1"
addColumn {
NAME: "id",
TYPE: "id_Integer"
}
addColumn {
NAME: "fullName",
TYPE: "id_String"
}
}
addSchema {
NAME: "out2",
CONNECTOR: "FLOW",
LABEL: "out2"
addColumn {
NAME: "id",
TYPE: "id_Integer"
}
addColumn {
NAME: "firstName",
TYPE: "id_String"
}
}
addMapperData {
addInputTable {
NAME: "row1"
addColumn {
NAME: "id",
TYPE: "id_Integer"
}
addColumn {
NAME: "firstName",
TYPE: "id_String"
}
}
addInputTable {
NAME: "row2",
ISINNERJOIN: true
addColumn {
NAME: "id",
TYPE: "id_Integer",
EXPRESSION: "row1.id "
}
addColumn {
NAME: "lastName",
TYPE: "id_String",
EXPRESSION: "\"London\""
}
}
addVarTable {
NAME: "Variables"
addColumn {
NAME: "var1",
TYPE: "id_String",
NULLABLE: true,
EXPRESSION: "StringHandling.UPCASE(row2.lastName)"
}
}
addOutputTable {
ID: "",
NAME: "out1"
addColumn {
NAME: "id",
TYPE: "id_Integer",
EXPRESSION: "row1.id"
}
addColumn {
NAME: "fullName",
TYPE: "id_String",
EXPRESSION: "row1.firstName + \" \" + Variables.var1"
}
}
addOutputTable {
ID: "",
NAME: "out2",
REJECTINNERJOIN: true
addColumn {
NAME: "id",
TYPE: "id_Integer",
EXPRESSION: "row1.id"
}
addColumn {
NAME: "firstName",
TYPE: "id_String",
EXPRESSION: "row1.firstName + \"(Last name mismatch or missing)\""
}
}
}
}