Abinitio Interview Question 4



Watch my YouTube video for explanation :




Please look into the class notes here for your references:


process the following using abinitio 


i/p
student_id,sub1, marks1, sub2, marks2,sub3,marks3
1, ss, 5, sanskrit,6, maths,10
2, science,6, maths ,7, physics,12

output  
stidentId sub    marks
| ss  |   5
| sanskrit  |   6
1 | maths| 10
2
2
2

filedName Filedvalue  stID
sub1      ss          1
marks1   4           1
sub2   sanskrit    1
marks2   6           1
sub3      maths       1
marks3    10          1
 


** creating multiple recs out of 1 rec - Normalize
** how many multiple rec from 1 rec - Length()






out::length(in)=
begin
let decimal("") l_cnt=length_of(string_split(in.rec,","))/2;
out::l_cnt;
end;



out::normalize(in,index)=
begin
let string(",")[int] l_rec_vec = 
string_split(string_split(in.rec,","));
let int[] count_vec = for(i,i<(length(l_rec_vec)/2)):i+1;

out.stidentId::in.rec.stidentId;
out.sub::l_rec_vec[index + count_vec[index]];
out.marks::l_rec_vec[index +count_vec[index] +1];
end;



output DML
record
string("|") stidentId,
string("|") sub,
decimal("\n") marks,
end;


Fore 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