Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to figure out how to implement this. I'm new to Talend and evaluating it for an upcoming project. The project has a bunch of legacy tables that will need to be unpivoted.
So, for example, I'd like to start with a table like this:
TrxId Name Amt1 Amt2 Amt3
1 Car 10 45 50
2 Truck 30 60 15
And end up with a table like this:
TrxId Name AmountType Amount
1 Car Amt1 10
1 Car Amt2 45
1 Car Amt3 50
2 Truck Amt1 30
2 Truck Amt2 60
2 Truck Amt3 15
Note that TrxId and Name are 'passed through' while the Amt1,2,3 columns are pivoted on a new column AmountType.
I'm not sure if I'm using the exact terminology here. Any help would be greatly appreciated.
Thanks.
tNormalize is missing a lot more than a little option to format the data. It doesn't bring the column names with it, which is a key part of an 'unpiviot' component. From where I sit, I'm not sure if this is possible with the current core.
So, with your understanding, which is far greater than mine, do you think I can use tNormalize as a template for an 'unpivot' component? Or is something going to stop me from finishing the job? Is it possible to bring the column names with it?
output_row.Metric = input_row.Metric;
output_row.Country = input_row.Country;
output_row.Value1 = input_row.Value1;
output_row.Value2 = input_row.Value2;
output_row.Value3 = input_row.Value3;
output_row.Value4 = input_row.Value4;
output_row.Value5 = input_row.Value5;
if (tos_count_tFileInputExcel_1<3)
globalMap.put(tos_count_tFileInputExcel_1==1?"Years":"Months",new String[] {input_row.Value1,input_row.Value2,input_row.Value3,input_row.Value4,input_row.Value5});
String[] Years = (String[])globalMap.get("Years");
String[] Months = (String[])globalMap.get("Months");
output_row.Metric = input_row.Metric;
output_row.State = input_row.Country;
output_row.Values = Years+","+Months+","+input_row.Value1+";"
+Years+","+Months+","+input_row.Value2+";"
+Years+","+Months+","+input_row.Value3+";"
+Years+","+Months+","+input_row.Value4+";"
+Years+","+Months+","+input_row.Value5+";";
Hello
Here comes a Java scenario, please see the screenshots.
Input file:
TrxId;Name;Amt1;Amt2;Amt3
1;Car;10;45;50
2;Truck;30;60;15
3;Shong;10;20;30
Result:
Starting job topic_4500 at 11:14 24/10/2008.
1|Car|Amt1|10
1|Car|Amt2|45
1|Car|Amt3|50
2|Truck|Amt1|30
2|Truck|Amt2|60
2|Truck|Amt3|15
3|Shong|Amt1|10
3|Shong|Amt2|20
3|Shong|Amt3|30
Job topic_4500 ended at 11:14 24/10/2008.
Feel free to post your question!
Best regards
shong
Hello,
Please have a look at this article about:https://community.talend.com/t5/Migration-Configuration-and/Converting-columns-to-rows/ta-p/21658/ju....
Best regards
Sabrina