Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everyone!
I have new to Talend, and Everyone was going fine until I ran into basic issue. I have a function that returns more than one value, so I created a class to hold these values and my function returns a type of that class. Now, in a TMap how can call this function once, and use the same object on different columns?
Thanks!
Hi there,
I'd suggest calling your function in a tJavaRow, and then setting the output row columns based on the properties of the returned class. You could add any necessary new flow fields in the output schema as required.
Depending how often you're likely to use this, you may even find it easier to simply drop the function code into your tJavaFlow component, where it can directly set the output flow columns, meaning you'd not need to create the return Class/object in the first place.
Regards,
Chris
Here's a very basic example to illustrate this:
In this case, the tFixedFlowInput generates rows which have two columns, and I've added two new columns to the output schema of the tJavaRow which are then populated in the code.
When setting this up in your own job, you'll likely want to click "Generate Code" once you have the input and output connected to the tJavaFlow, added/removed fields from the output schema, and before you begin adding your own code etc., as this will generate the basic code to pass data from all of the input to the output fields.
Regards,
Chris