Input: Output: Id Name Id Name - A Name - B Name - C

You might also like

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 8

Transform the below input data in a file to the following

output database table:

Input: Output:
Id Name Id Name_A Name_B Name_C
10 aa 10 aa bb cc
10 bb 20 aa bb
10 cc 30 bb
20 aa 40 aa
20 bb 50 cc
30 bb
40 aa
50 cc

Source -> Sorter (Asc by ID) -> AGG TRF { Create Three output ports. Each output port has this condition
MAX(DECODE(Name,'aa',Name)), MAX(DECODE(Name,'bb',Name)), MAX(DECODE(Name,'cc',Name))} and use group by id
dition
e))} and use group by id connect id and three output groups to target.
If the source data contains unique and duplicate records then transform the data to
load unique records in one target and duplicate records in another target:

Input: Target 1: Aggregator


Id Id Id Count
1 2 1 2
1 5 2 1
2 3 3
3 Target 2: 4 2
3 Id 5 1
3 1
4 1 Input:
4 3 Id
5 3 1
3 1
4 2
4 3
3
3
4
4
5

Source -> Sorter (Sort on Id - Assuming unsorted data) -> Aggregator (Group on Id and Calculate the Count of Id) - > Joiner (Joi
will contain the rows where Count of Id = 1 and another group will contain the rows where Count of ID > 1) -> Populate these
another target will contain duplicate records.
Joiner
Id Count
1 2
1 2
2 1
3 3
3 3
->' 3 3
4 2
4 2
5 1

the Count of Id) - > Joiner (Join the original data with the output of Aggregator on Id Column ) -> Router (One Group
nt of ID > 1) -> Populate these groups into two seperate targets. The first target will contain the unique records and
If the source data contains unique and duplicate records then transform the data to
load the first occurrence of each record in one target and the remaining duplicate
records in another target:

Input: Target 1: Expression


Id Id V_Prev_Val V_Curr_Val
1 1 1
1 2 1 1
2 3 1 2
3 4 2 3
3 5 3 3
3 3 3
4 Target 2: 3 4
4 Id 4 4
5 1 4 5
3
3
4

Expression Logic:
V_Curr_Val = Id
V_Seq = IIF(V_Curr_Val = V_Prev_Val, V_Seq + 1, 1)
V_Prev_Val = V_Curr_Val
Out_Seq = V_Seq

Source -> Sorter (Sort on Id - Assuming unsorted data) -> Expression (Using variables create a cycling sequence for the same va
-> Router (One Group will contain the rows where expression generated sequence id = 1 and another group will contain the r
expression generated sequence id > 1) -> Populate these groups into two seperate targets. The first target will contain the the
each record and another target will contain the remaining duplicate records
Expression
V_Seq V_Prev_Val Out_Seq Id
1 1 1 1
2 1 2 1
1 2 1 2
1 3 1 3
2 3 2 3
3 3 3 3
1 4 1 4
2 4 2 4
1 5 1 5

equence for the same values)


group will contain the rows where
arget will contain the the first occurrence of
Transform the below input data in a file to get the last 3
records:

Expression with Sequence Generator ->'


Input: Output: Seq Id Id Dummy
Id Id 1 3 1
3 9 2 6 1
6 1 3 2 1
2 6 4 7 1
7 5 9 1
9 6 1 1
1 7 6 1
6 ->'
Aggregator
Id Count Dummy
6 7 1

Source -> Sequence Generator -> Aggregator (Calculate the total number of records by Counting the records without Grouping
on any field) -> Joiner (Perform a Normal Join to join the original dataset with the output of the Aggregator on the Dummy por
created in both the datasets) -> Filter (Pass the records where Count - Seq Id <= 2)
Joiner
Seq Id Id Dummy Count
1 3 1 7
2 6 1 7
3 2 1 7
4 7 1 7
5 9 1 7
6 1 1 7
7 6 1 7

ting the records without Grouping by


he Aggregator on the Dummy port

You might also like