Вы находитесь на странице: 1из 3

RANK TRANSFORMATION

Active and connected transformation The Rank transformation allows us to select only the top or bottom rank of data. It Allows us to select a group of top or bottom values, not just one value. During the session, the ower !enter "erver caches input data until it can perform The rank calculations. Rank Transformation Properties : !ache Directory where cache will be made. Top#$ottom Rank as per need %umber of Ranks &'( ), * or any number !ase "ensitive !omparison can be checked if needed Rank Data !ache "i+e can be set Rank Inde' !ache "i+e can be set Ports in a Rank Transformation :

Ports I

Number Required ) ,inimum

Description ort to receive data from another transformation. ort we want to pass to other transformation. can use to store values or calculations to use in an e'pression. Rank port. Rank is calculated according to it. The Rank port is an input#output port. /e must link the Rank port to another transformation. &'ample( Total "alary

) ,inimum

not needed

-nly )

Rank Index

The Designer automatically creates a RA%0I%D&1 port for each Rank transformation. The ower !enter "erver uses the Rank Inde' port to store the ranking position for &ach row in a group. For example, if we create a Rank transformation that ranks the top five salaried employees, the rank inde' numbers the employees from ) to 2. The RA%0I%D&1 is an output port only. /e can pass the rank inde' to another transformation in the mapping or directly to a target. /e cannot delete or edit it. Defining Groups Rank transformation allows us to group information. 3or e'ample( If we want to select the top 4 salaried employees of each Department, we can define a group for Department. $y defining groups, we create one set of ranked rows for each group. /e define a group in orts tab. !lick the 5roup $y for needed port. /e cannot 5roup $y on port which is also Rank ort. )6 xample: Finding Top ! "alaried mplo#ees &, will be source table. !reate a target table &, 7RA%07&1A, 8& in target designer. "tructure should be same as &, table. 9ust add one more port Rank7Inde' to store RA%0 I%D&1. !reate the shortcuts in your folder. $reating %apping: ). -pen folder where we want to create the mapping. *. !lick Tools :; ,apping Designer. 4. !lick ,apping:; !reate:; 5ive mapping name. &'( m7rank7e'ample <. Drag &, from source in mapping. 2. !reate an &1 R&""I-% transformation to calculate T-TA87"A8. =. !lick Transformation :; !reate :; "elect RA%0 from list. 5ive name and click !reate. %ow click done. >. ass ports from &'pression to Rank Transformation. ?. &dit Rank Transformation. 5o to orts Tab @. "elect T-TA87"A8 as rank port. !heck R type in front of T-TA87"A8. )A. !lick roperties Tab and "elect roperties as needed. )). Top in Top#$ottom and %umber of Ranks as 2. )*. !lick Apply :; -k. )4. Drag target table now.

)<. !onnect the output ports from Rank to target table. )2. !lick ,apping :; .alidate )=. Repository :; "ave !reate "ession and /orkflow as described earlier. Run the /orkflow and see the data in target table. ,ake sure to give connection information for all tables. &' xample: Finding Top & "alaried mplo#ees for e(er# D P)RT% NT -pen the mapping made above. &dit Rank Transformation. 5o to orts Tab. "elect 5roup $y for D& T%-. 5o to roperties tab. "et %umber of Ranks as *. !lick Apply :; -k. ,apping :; .alidate and Repository "ave. Refresh the session by double clicking. "ave the changed and run workflow to see the new result. R)N* $)$+ "ample Rank %apping /hen the ower !enter "erver runs a session with a Rank transformation, it compares an input row with rows in the data cache. If the input row out: ranks a "tored row, the ower !enter "erver replaces the stored row with the input row. xample: ower !enter caches the first 2 rows if we are finding top 2 salaried &mployees. /hen =th row is read, it compares it with 2 rows in cache and places it in !ache is needed. )6 R)N* IND , $)$+ : The inde' cache holds group information from the group by ports. If we are Bsing 5roup $y on D& T%-, then this cache stores values )A, *A, 4A etc. All 5roup $y !olumns are in RA%0 I%D&1 !A!C&. &'. D& T%*6 R)N* D)T) $)$+ : It holds row data until the ower !enter "erver completes the ranking and is 5enerally larger than the inde' cache. To reduce the data cache si+e, connect -nly the necessary input#output ports to subseDuent transformations. All .ariable ports if there, Rank ort, All ports going out from RA%0 Transformations are stored in RA%0 DATA !A!C&. xample: All ports e'cept D& T%- In our mapping e'ample

Вам также может понравиться