In this example, three tLogRow components are used to display the unprocessed records, the accepted records and the rejected records respectively, in the form of tables, and a tJava component is used to display the summary information. Use the procedure below to define these components.
Procedure
-
Enter the following script code to add and define the first
tLogRow component.
This component must have the same schema structure as the tReplicate component.
// print unprocessed records addComponent { setComponentDefinition { TYPE: "tLogRow", NAME: "tLogRow_1", POSITION: 512, 160 } setSettings { BASIC_MODE : "false", TABLE_PRINT : "true", VERTICAL : "false", PRINT_UNIQUE : "true", LABEL : "unprocessed_records" } addSchema { NAME: "tLogRow_1", CONNECTOR: "FLOW" addColumn { NAME: "name", TYPE: "id_String" } addColumn { NAME: "gender", TYPE: "id_String" } addColumn { NAME: "age", TYPE: "id_Integer", LENGTH: 2 } addColumn { NAME: "city", TYPE: "id_String" } addColumn { NAME: "marriageStatus", TYPE: "id_String" } } }
-
Enter the following script code to add and define the second
tLogRow component.
This component must have the same schema structure as the ACCEPT flow of the tFilterRow component.
// print accepted records addComponent { setComponentDefinition { TYPE: "tLogRow", NAME: "tLogRow_2", POSITION: 832, 224 } setSettings { BASIC_MODE : "false", TABLE_PRINT : "true", VERTICAL : "false", PRINT_UNIQUE : "true", LABEL : "accepted_records" } addSchema { NAME: "tLogRow_2", CONNECTOR: "FLOW" addColumn { NAME: "name", TYPE: "id_String" } addColumn { NAME: "gender", TYPE: "id_String" } addColumn { NAME: "age", TYPE: "id_Integer", LENGTH: 2 } addColumn { NAME: "city", TYPE: "id_String" } } }
-
Enter the following script code to add and define the third
tLogRow component.
This component must have the same schema structure as the REJECTED flow of the tFilterRow component.
// print rejected records addComponent { setComponentDefinition { TYPE: "tLogRow", NAME: "tLogRow_3", POSITION: 832, 288 } setSettings { BASIC_MODE : "false", TABLE_PRINT : "true", VERTICAL : "false", PRINT_UNIQUE : "true", LABEL : "rejected_records" } addSchema { NAME: "tLogRow_3", CONNECTOR: "FLOW" addColumn { NAME: "name", TYPE: "id_String" } addColumn { NAME: "gender", TYPE: "id_String" } addColumn { NAME: "age", TYPE: "id_Integer", LENGTH: 2 } addColumn { NAME: "city", TYPE: "id_String" } addColumn { NAME: "errorMessage", TYPE: "id_String", NULLABLE: true, LENGTH: 255, PRECISION: 0 } } }
Warning:The errorMessage column is required and it has fixed properties for the REJECTED output flow.
-
Enter the following script code to add and define the tJava component.
This component will call the global variables of the tLogRow components to show the number of rows each of them has handled. While this component doesn't have any schema columns to define, you need to provide the Java code to be executed in the
setSettings {}
function.// print summary addComponent { setComponentDefinition { TYPE: "tJava", NAME: "tJava_1", POSITION: 160, 416 } setSettings { CODE : "System.out.println(\"\\n\" + \"Total number of records : \"+globalMap.get(\"tLogRow_1_NB_LINE\") + \"\\n\" + \"Number of records accepted : \"+globalMap.get(\"tLogRow_2_NB_LINE\") + \"\\n\" + \"Number of records rejected : \"+globalMap.get(\"tLogRow_3_NB_LINE\") + \"\\n\" + \"\\n\" );", LABEL : "print_summary" } addSchema { NAME: "tJava_1", CONNECTOR: "FLOW" } }
Warning:Be sure to use a backslash (\) when specifying a metacharacter.