Page 1 of 1

How to get the last record in a sur key state file

Posted: Tue Feb 15, 2011 3:03 pm
by Marley777
Hi, anyone ever tried getting the last record in a surrogate key state file? I know I can use the sur key generator to view the file, but when I create a output link from the sur key gen stage I get all records in the file...only want the last value or record from the file and use it down stream. I know I can also use a transformer with logic of some kind to get the max, but wondering if there is an easier way that doesn't involve the transformer? Thanks for any help you can provide.

Posted: Tue Feb 15, 2011 3:35 pm
by ray.wurlod
SKey ---> ColGen --> RemDup --> ...

Column Generator generates a constant "key" and Remove Duplicates preserves the last row.

Execute in Sequential mode.

Posted: Tue Feb 15, 2011 10:26 pm
by mansoor_nb
You can also use Tail stage in the sequential mode by setting the Number Of Rows (Per Partition) = 1. By this the last row is retained for down stream process.

SKey ---> Tail --> ...

Thanks