Posts

Showing posts with the label Reformat Component

S) How to remove any object form EME?

 air object rm <EME object eme>

T) Explain the Run time Behaviour of Reformat Component ?

The Reformat component processes your data records through these steps: Basic Setup: Each output port is numbered (out0, out1, out2, etc.) Each output has matching reject and error ports (reject0/error0, reject1/error1, etc.) Step-by-Step Process: Read a Record Takes one record from the input port Check Selection Filter (if you have one) If the filter expression returns FALSE : Record is skipped, go to next record If the filter returns NULL : Graph stops with an error message If the filter returns TRUE (or no filter exists): Continue processing Determine Where to Send the Record If you have only one output port : Record goes to that port automatically If you have multiple output ports : Uses output-index to decide which port(s) get this record Can send to one port or multiple ports If there's an error choosing ports, record goes to reject0 Transform the Record For each designated output port: If no transform is defined: Uses automatic field mapping If transform is defined: Runs ...

S) Output index example

Image
 Input Data               Reformat   Count =3   /*Function returning index of output port*/   output_index_ out :: output_index (in)=   begin   output_index_ out :: if( in.gender =="M")0 else if ( in.gender =="F") 1 ;   end;    

S) Header trailer scenario using reformat & lookup

Image
          FBE   Next_in_sequence ==1;   Reformat   output_index_ out : : output_index (in) =   begin     output_index_ out : : if ( next_in_sequence () == lookup_count ( " hh " ) ) 1 else 0;   end ;    

S) How to merge two different column into a single column

Image
input        Output 1 A                1A 2 B               2B 3 C              3C 4 D              4D           Reformat   Out ::reformat (in)=   begin   Out.alfa :: string_concat ( in.id ,in.alfa );   end     Input DML     record   decimal ( "| " )id ;   string ( "\n " ) alfa ;   end     Output DML   re cord   String(“\n ”) alfa ;   end    

S) Reformat and normalize example -- Input : 1,2,3-7,8,9

Image
 Input : 1,2,3-7,8,9 Output : 1 2 3 4 5 6 7 8 9  Solution  let decimal ( 4)val 1 =0;   let decimal ( 4)val 2 =0;   let decimal ( 4)diff =0;     out:: reformat(in)=   begin   if ( string_index (in.id, "-" ))           begin           val1 = string_substring ( string_replace ( string_substring (in.id, 1,string _index(in.id, "-" )-1), "," , " " ),1,1);           val2= string_substring ( string_replace ( string_substring ( in.id,string_index (in.id, "-" )+ 1,string _length(in.id)), "," , "" ),3,1);           diff =(val2-val 1)+ 1;           end     else diff =1;     out.id : : if ( string_index (in.id, "-" )> 0) val 1  else in.id;     out.diff :: diff;     end ;   Normalize   out:: len...