Source Like
department_no, employee_name
----------------------------
20, R
10, A
10, D
20, P
10, B
10, C
20, Q
20, S
and Output should be like this
department_no, employee_list
--------------------------------
10, A
10, A,B
10, A,B,C
10, A,B,C,D
20, A,B,C,D,P
20, A,B,C,D,P,Q
20, A,B,C,D,P,Q,R
20, A,B,C,D,P,Q,R,S
Answers were Sorted based on User's Feedback
small modification to the above ans:
SRC---->Transformer--->TGT
we do the 'HASH' partitioning on Dept_No.
SetNull value to the Stage variable----->SV_List
In the transformer stage variables:
SV_List :',' : Employee_Name ----->SV_List (Concatenating Employee
Names)
In the Column Derivation:
TRIM(SV_list, ',' , 'L')------->Employee_Name
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / srinivas
By using the stage variables in transformer we can do this.
Before going to use transformer sort the data based on two columns.Order should be like below
Deptno Empname
10 A
10 B
SO ON...
After that in transformer take 3 stage varibles
stg1--->map the sorted Deptcolumn
stg2---> DSLink2.empname:',' (map the empname column and concatenate comma operator)
Stg2--->stg3:stg2 (concatenate first two staging varibles)
Then
In derivation of employee_list column (In transformer)
use below function
TRIM(stg3,',','T')---->employee_list (column derviarion)
It will gives you as expected result.
Thanks
Sri
| Is This Answer Correct ? | 5 Yes | 3 No |
SRC---->Transformer--->TGT
we do the 'HASH' partitioning.
SetNull value to the Stage variable----->SV_List
In the transformer stage variables:
SV_List : Employee_Name ----->SV_List (Concatenating Employee
Names)
In the Column Derivation:
SV_list------->Employee_Name
| Is This Answer Correct ? | 3 Yes | 1 No |
Hi Friends, I have a input data like, class_id Marks 101 50 101 60 101 40 102 90 102 35 And i want my output data like class_id Marks Rank 101 50 2 101 60 1 101 40 3 102 90 1 102 35 2 how to do this in datastage?
8 Answers Cognizant, HCL, TIAA CREF,
Lookup constraints
If the job aborted in a sequencer, how can we start that from the previews successful job.
Wat is isolation level and when do u use them?
how can you generate sequence number using only the sequential file stage?
Define orabulk and bcp stages?
if we using two sources having same meta data and how to check the data in two sources is same or not? and if the data is not same i want to abort the job ?how we can do this?
Hi This is Vijay How Can u Read the data from sequential file Parall'y?
if i have two tables table1 table2 1a 1a,b,c,d 1b 2a,b,c,d,e 1c 1d 2a 2b 2c 2d 2e how can i get data as same as in tables?chandu how can i implement scd typ1 and type2 in both server and in parallel?chandu field1 field2 field3 suresh , 10,324 , 355 , 1234 ram , 23,456 , 450 , 456 balu ,40,346,23 , 275, 5678 how to remove the ,inthe fields?
Explain the datastage parallel extender (px) or enterprise edition (ee)?
How to remove duplicates in transformer stage? in parallel mode
Explain entity, attribute and relationship in datastage?