How to pass calculated values between tJava and tFileCopy Talend components?

StackOverflow https://stackoverflow.com/questions/23660044

  •  22-07-2023
  •  | 
  •  

Domanda

I want to obtain a value from executing a java code routine called from a tJava component and then use that value on the Destination filename textbox of the tFileCopy component. How can I do that?

È stato utile?

Soluzione

you can use context variable to hold the value which is return by routine and then use same variable in tFileCopy component. context variables can be used in most of the component to share values.

Altri suggerimenti

The global map can be used to share data across a job (but not outside of the job). This is typically accessed with a tFlowToIterate that will implicitly dump the data for a row into the global map and then iteratively process the rest of the job on that data but you can also access it directly.

To access the globalMap directly you can use globalMap.put in the tJava component and then access it using globalMap.get in your tFileCopy component.

The global map is stored as a key-value pair combination of a string and object so you'll need to re-cast the value back into a string for your tFileCopy component using (String) globalMap.get("key").

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top