Input data
Acc_num | Transaction_Type_ID | Transaction_type |
---|---|---|
2156 | 1 | Cash deposit |
2156 | 3 | Pin change |
8463 | 2 | Cash Withdraw |
8463 | 4 | Balance enquiry |
8463 | 1 | Cash deposit |
Output structure should be group by customer_id and concatenate notes from the multiple records.
Acc_num | Transaction_type_out |
---|---|
2156 | 1 Cash deposit 3 Pin change |
8463 | 2 Cash Withdraw 4 Balance enquiry 1 Cash deposit |
Solution:
Step 1: Sort the input records based on Acc_num
Step 2: Create a variable (v_type) in expression transformation to concatenate Transaction_type_id and Transaction_type: Transaction_type_id || Transaction_type.
Step 3: Create another variable holding the value of v_type (v_type_curr) and another variable to hold the value of previous v_type (v_type_prev). loop through the Acc_num and as long as it reads the same Acc_num, output Transaction_type_out (Target column) = v_type_curr || v_type_prev.
Transformations to be used:
SQ/Sorter for step 1
Expression for step 2
Comments
Post a Comment