Skip to main content

tMap example

The following example of tMap shows how to:

  • enable perform automatic data type conversion
  • define output schemas
  • define a main input table and a lookup table, with an inner join between them
  • define a variable table
  • define mappings between the input, variable, and output tables
  • define data transformation
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)\""
			}
		}
	}
}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!