How to use column index in Talend?

One Star

How to use column index in Talend?

I know in C# we can do something like "Table = value;" or "Table = value;"
Is there similar function avaiable in Talend to do the same thing?
The problem we are having right now is we have one source table with column "code" and "value", one lookup table with column "code" and "field", and one target table with column "ID, Field1, Field2, Field3.....". What we want to do is to loop through all the data in source table, for each code, based on lookup table, find the field name in "field", and put into target table which the field name is the value of "field" in lookup table.
Has anyone done this kind of operation before?
One Star

Re: How to use column index in Talend?

From what im reading it seems like you want to do an inner join with the source and the lookup. When the source ?code? and the lookup ?code? match then you want to put that corresponding ?field? into the target table. Is that correct?
If so it is pretty standard. You would just use a tMap. Go into the tMap. In the lookup column ?code? type source.code to connect the source ?code? column to the lookup ?code? column (source is the name for the main row in the job by default it is row1(Main)). Check the inner join check box above the lookup table. Drag and drop the columns that you are migrating over into the output table on the right hand side of the tMap.



To answer your first inquiry, calling a specific column in a table would be something like this ...
input_row.column_name
...Where column_name is the name of the column. This will give you access to each element in that specific column for rows as they pass through the component.
Employee

Re: How to use column index in Talend?

I have a little trouble understanding your problem. Is this that you want to be able to dynamically pick the output field name from your lookup table and set the value of it to "value" from your source table?
What is your job? if you can post some screenshots of your job so far that could help us?