Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi all
i have one record with following data
input
ID CODE PRICE
123 C2345 500
now i need to make two records from it
c2345==2345:5678 (this code am having in my sheet i need to compare the sheet and generate it)
output
ID CODE PRICE
123 2345 499
123 5678 1
Thanks®ards
bhagyarekha
How did you split the price column ?
Assuming that , you have another sheet with data like
CODE MAPEDCODE
C2345 2345:5678
in tMap , do a join between two sheet,so that output of tmap will be
ID CODE PRICE
123 2345:5678 500
the use tNornamise - Code
ID CODE PRICE
123 2345 500
123 5678 500
Now on tJavaRow ,
output_row.ID=input_row.ID
output_row.CODE=input_row.CODE
output_row.PRICE = input_row.PRICE - Numeric.sequence(input_row.ID,0,1)
sorry try this
Integer seq = Numeric.sequence(input_row.ID,1,1) ;
output_row.ID=input_row.ID;
output_row.CODE=input_row.CODE;
output_row.PRICE = (seq == 1)?input_row.PRICE - seq : seq - 1;
Hi,
Could you please try below method?
The component details are as below.
Please maintain the order of the tMaps as shown in picture. Instead of hard coding, you can even convert the value 1 with a context variable if the discount is different for each run.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Hope you were able to resolve your issue by one of the above methods.
If you do not have any outstanding queries, could you please mark the topic as resolved by marking the posts which helped you?
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂