Intan Kiswari
Intan Kiswari

Reputation: 1

Talend - Dynamic Column Name (Enterprise version)

Can anyone help me solve this case?

I have much file to process, two of them is like on below screenshot with my expected output.

the screenshot of my file input and my expected output

I use this transformation on Talend: tFileList---tInputExcel---tUnpivotRow---tMap---tPostgresqlOutput

The output is different to my expected output. This is the screenshot of the output

the screenshot of output of transformation

Can anyone help me to reach my expected output which is like on my first picture above?

Upvotes: 0

Views: 530

Answers (1)

Balazs Gunics
Balazs Gunics

Reputation: 2067

This will be pretty hard. You'd have to handle that as a text file. And whenever you found "store" value in the first column you'd update your type with the value.

Here's how I'd start: Basically tJavaFlex begin piece would contain:

String col1Type
String colNType

main part:

if input_row.col0.equalsIgnoreCase("store") {
col1Type = input_row.col1;
col2Type = input_row.col2;
colNType = input_row.colN;
continue; /*(so this record will be Ignored for the rest of the components!)*/
}
output_row.col1Type = col1Type;
output_row.col1Value = Integer.valueOf(input_row.col1); 
/*coz we have text and need numbers :( */

I think using propagate results will save you from writing down all the other fields. And from here it would be very simple as you have key-type-value-type-value-type-value results.

Upvotes: 1

Related Questions