swapping selected values from one column to other using any transformation
I have two columns named amount
and work
with data in the format of given below:
amount 58220 84151 65999 23 78544 开发者_Go百科 52656
work 15 14 20 85597 22 19
and I want to swap the values of 23 and 85597 which are in the same row. Can you suggest me a suitable solution?
Create a transformation following the steps:
build file
inputdata.txt
(or other source of data for the flow)value1, value2 58220, 15 84151, 14 65999, 20 23, 85597 78544, 22 52656, 19
add code in javascript step
var t1 = value1; var t2 = value2;
In the menu "Fields" choose Rename
t1
tovalue2
andt2
tovalue1
and check the option to replace values??.the results are:
value1, value2 15, 58220 14, 84151 20, 65999 85597, 23 22, 78544 19, 52656
If you need the source code I send by email.
精彩评论