Abinitio Interview Questions 26



Watch my YouTube video for explanation :


    
        


Get the unique values from the input data
Input
code, country
1, India
2, Mumbai
1, USA
2, Newyork
1,          UK
2, Edinburgh
2, London




output
code, countries
2, India,Mumbai
2, USA,Newyork
2, UK,Edinburgh,London







type temporary_type=
record
string(",") l_countries;
decimal("") cnt;
end;

temp::initialize(in)=
begin
temp.l_countries::in.country;
temp.cnt::0;
end;


out::key_change(in1,in2)=
begin
out::if(in1.code==1);

end;


out::rollup(temp,in)=
begin
out.l_countries::if(temp.cnt!0) string_concat(temp.countries,',',in.country);
out.cnt::temp.cnt+1;
end;

out::finalize(temp,in)=
begin
out.code::in.code;
out.countries::temp.l_countries;
end;



output
code, countries
2, India,Mumbai
2, USA,Newyork
2, UK,Edinburgh



For more Abinitio, AWS and data engineering videos please subscribe , view , like and share my YouTube channel 
Click DataPundit

Comments

Popular posts from this blog

Abinitio Interview Question # 1 - Write Multiple Files in Abinitio

Next In Sequence in ABinitio | How next_in_sequence() works in MFS