Abinitio Interview Scenario Based Question 38

            Abinitio Interview Scenario Based Question 38

           Watch my YouTube Video for this as below:




 Solve Using Abinitio 

Input

DeptID  teacher    IsAssigned

D1      Teacher1   1

D1      Teacher2   1

D1      Teacher3   0

D2      Teacher1   0

D2      Teacher2   1

D2   Teacher3   0

    

   

DeptID   Teacher1    Teacher2   Teacher3

D1 1 1 0

D2 0 1 0



Input--->Rollup(DeptID)-> Output


teporary type=

begin

decimal("") Teacher1;

decimal("") Teacher2;

decimal("") Teacher3;

end;


out::initialize(temp,in)=

begin

out.Teacher1::0;

out.Teacher2::0;

out.Teacher3::0;

end;


out::rollup(temp,in)=

begin

out.Teacher1::if(in.Teacher=='Teacher1' and in.IsAssigned ==1) 1;

out.Teacher2::if(in.Teacher=='Teacher2' and in.IsAssigned ==1) 1;

out.Teacher3::if(in.Teacher=='Teacher2' and in.IsAssigned ==1) 1;

end;



out::finalize(temp,in)=

begin

out.DeptID::in.DeptID;

out.Teacher1::temp.Teacher1;

out.Teacher2::temp.Teacher2;

out.Teacher3::temp.Teacher3;

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