Abinitio Interview Question 45

                          Abinitio Interview Question 45




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;

For More Abinitio, AWS, Database content please visit my youTube channel.

https://www.youtube.com/@datapundit

@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