Hi,
I have a requirement as shown below:
Input Records:
Coulmn1 Column2
123 AF
XC RG
qw aa
POP aa
RT NN
FM AF
OutPut Records:
Coulmn1 Column2
123 XX
XC RG
qw XX
POP XX
RT NN
FM XX
If values for Column2 input file has repeated vlaue like more then one then those records should replace with 'XX', if unique then the same records.
Please help how can we do this.
Thanks and Regards,
Assign value for more then one record
Moderators: chulett, rschirm, roy
Hmm.
2 ways spring to mind.
Option 1
1. Sort by Column 2, then by column 1. Add a keyChange columns
2. In a transformer, on the input link re-sort by column 2, keychange asc.
3. In a stage variable (sv1), hold the value of column 2 where keychange = 0
4. In another stage variable have the logic: If keyChange = 0 then 'XX' else if input.column2 = sv1 then 'XX' else input.Column2
Option 2
1. Split off column2 through an aggregator and perform a count on column2.
2. Join the count column back to the data stream using column 2 as the key.
3. In a transformer, check if the count column is greater than 1, and if true then set output to 'XX'
Or something like that.
2 ways spring to mind.
Option 1
1. Sort by Column 2, then by column 1. Add a keyChange columns
2. In a transformer, on the input link re-sort by column 2, keychange asc.
3. In a stage variable (sv1), hold the value of column 2 where keychange = 0
4. In another stage variable have the logic: If keyChange = 0 then 'XX' else if input.column2 = sv1 then 'XX' else input.Column2
Option 2
1. Split off column2 through an aggregator and perform a count on column2.
2. Join the count column back to the data stream using column 2 as the key.
3. In a transformer, check if the count column is greater than 1, and if true then set output to 'XX'
Or something like that.