Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All
I'm new to Talend and I'm trying to learn it know. I already saw most of the available videos and I have to say that's an amazing tool.
So let's go to the topic. I need to calculate a value based on two columns from a excel file. I have the Starting Kms and the arriving Kms and with the collection of the data I wont to have a column with the difference between this 2 values.
This way I will have the traveled Kms by a car or person.
Is this possible to do in Talend? if Yes how can I do it? Is it inside Tmap?
Thanks in advance
Nelson Parreira
This is very easy to do. Lets assume your starting and ending values are in columns A and B in your Excel spreadsheet. You configure your tFileInputExcel component so that you are bringing in columns A and B. This is described in the documentation for the component. Once you have done this, add a tMap component. In this component you can set the output "table" to have 3 columns (A, B and C). You may your input column A to the output column A, B to B and in the output of C you would have some code looking something like this....
row1.B!=null && row1.A!=null ? row1.B - row1.A : 0
The above will first check that the values of A and B are not null. It then subtracts A from B. If either of the values are null, it will return 0.
This is very easy to do. Lets assume your starting and ending values are in columns A and B in your Excel spreadsheet. You configure your tFileInputExcel component so that you are bringing in columns A and B. This is described in the documentation for the component. Once you have done this, add a tMap component. In this component you can set the output "table" to have 3 columns (A, B and C). You may your input column A to the output column A, B to B and in the output of C you would have some code looking something like this....
row1.B!=null && row1.A!=null ? row1.B - row1.A : 0
The above will first check that the values of A and B are not null. It then subtracts A from B. If either of the values are null, it will return 0.
Great rhall_2_0
It was exactly what I was looking for.