tSetGlobalVar is a Talend Open Studio component that allows you to map a field from an input flow to a global variable.
This job shows an input flow -- in this case a tFixedFlowInput -- being connected to a tFlowToIterate. The tFixedFlowInput can be replaced with a more useful component like a tOracleInput. The tFixedFlowInput demonstrates how this would look for a single-record result such a SUM or a COUNT in a SQL query. The top subject (tFixedFlowInput -> tFlowToIterate -> tSetGlobalVar) will loop for each record in the input flow. For inputs returning more than one record, be aware that the tSetGlobalVar in this subjob would set the global for the last record.
Job Containing a tSetGlobalVar |
Certain components are flow-based (tMsSqlInput, tOracleOutput) while others are iteration-based (tSetGlobalVar, tJava). Both flow and iterate are loops. The difference between the two is that the flow-based components are driven by a result set (SQL query, lines in a text file, XML elements) and that a schema is made available to downstream components.
tFixedFlowInput Configuration |
tSetGlobalVar Configuration |
Finally, in a separate subjob, I output the value of my global using a tJava.
Using the Global in a tJava |
No comments:
Post a Comment