Abinitio Dense Rank - Template Mode SCAN
Abinitio Dense Rank Evaluation by Scan without transform expansion
Watch my yourube video here:
2. Same as Dense_Rank() function is SQL
INPUT-> SORT (dept, sal desc) -> Scan-> OUTPUT
Rank Evaluation by Scan without transform expansion
Use SCAN with key deptId.
let int _d_ranking_ =0; // use global variable to track/update the rankings
out::scan(int)=
begin
//previous() fuction returns NULL for the first record in each group,
//so the assignment is such situations is 1.
_d_ranking_=first_defined(if(previous(in.sal)!=in.sal) _d_ranking_+1 else _d_ranking_,1);
out.*::in.*;
out.dense_rank::_d_ranking_;
end;
deptId , empId, Sal, Drank
D1, E1, 890 2
D1, E2, 750 3
D1, E9, 750 3
D1, E3, 895 1
D1, E11, 740 4
D2, E4, 800 2
D2, E5, 900 1
D3, E8, 500 1
For More Abinitio AWS Database content please visit my youTube channel.
https://www.youtube.com/@datapundit
@datapundit
Comments
Post a Comment