Scenario:
I have my source data like below:
ID Line-no Text
529 3 DI-9001
529 4 DI-9003
840 2 PR-031
840 2 DI-9001
616 1 PR-029
874 2 DI-9003
874 1 PR-031
959 1 PR-019
Now I want my target to be
ID Line-no Text
529 3 DI-9001
529 4 DI-9003
840 2 PR-031&DI-9001
616 1 PR-029
874 2 DI-9003
874 1 PR-031
959 1 PR-019
It means if both the ID and the LINE_NO both are same then the TEXT should concatenate, else no change
ID Line-no Text
529 3 DI-9001
529 4 DI-9003
840 2 PR-031
840 2 DI-9001
616 1 PR-029
874 2 DI-9003
874 1 PR-031
959 1 PR-019
Now I want my target to be
ID Line-no Text
529 3 DI-9001
529 4 DI-9003
840 2 PR-031&DI-9001
616 1 PR-029
874 2 DI-9003
874 1 PR-031
959 1 PR-019
It means if both the ID and the LINE_NO both are same then the TEXT should concatenate, else no change
Solution:
The mapping flow like this:
source-->sq-->srttrans-->exptrans--->aggtrans--->target
srttrans--->sort by ID, line_no ASC order
exp-->use variable ports as
ID(I/O)
Line_no(i/o)
Text(i)
source-->sq-->srttrans-->exptrans--->aggtrans--->target
srttrans--->sort by ID, line_no ASC order
exp-->use variable ports as
ID(I/O)
Line_no(i/o)
Text(i)
text_v : iif(ID=pre_id and Line_no=pre_line_no,Text_v||'&'||Text,Text)
pre_id(v):ID
pre_line_no(v):Line_no
Text_op:Text_v
Aggtrans-->group by ID and Line_no. It will return last row which is
concatenation of text
Then pass to the Target.
pre_id(v):ID
pre_line_no(v):Line_no
Text_op:Text_v
Aggtrans-->group by ID and Line_no. It will return last row which is
concatenation of text
Then pass to the Target.
Comments
Post a Comment