First N and Last N
First N
The First N tool lets you extract a specified number of records from an input, starting at the beginning of the table. This is useful for extracting the "first," "top," or "best" records according to some ordering. For example, you can use the First N tool to:
Find your top ten revenue-producing products for the last year.
Find your hundred best customers according to last year's purchases.
Find the fifty most frequently-occurring names in a list.
Process only the first 1000 records from an input—useful for debugging.
Typically, you connect the First N tool to an input that has been sorted so that the records of interest appear first. For example, to find your ten best customers you might first summarize sales per customer, then sort descending on total sales, and finally use the First N tool with "N" set to ten.
If your input has less than the desired number of records, you will get all available records.
First N tool configuration parameters
The First N tool has a single configuration parameter in addition to the standard execution options.
Parameter | Description |
---|---|
Choose the first | The desired number of records. Defaults to 1. |
Configure the First N tool
Select the First N tool.
Go to the Configuration tab on the Properties pane.
Enter the desired number of records in the Choose the first box.
Optionally, go to the Execution tab, and then set Web service options.
Last N
The Last N tool lets you extract a specified number of records from an input file, starting at the end of the file. This is useful for extracting the "last," "bottom," or "worst" records according to some ordering. It is the exact opposite of the First N tool. You can use this tool to:
Find your bottom ten revenue-producing products for the last year.
Find your hundred worst customers according to last year's purchases.
Find the fifty least frequently occurring names in a list.
Typically, you connect the Last N tool to an input that is already sorted to put the "best" records first. For example, to find your ten worst customers you might first summarize sales per customer, sort on total sales, and finally use the Last N tool with "N" set to ten.
If your input has less than the desired number of records, you will get all available records.
Last N tool configuration parameters
The Last N tool has a single configuration parameter in addition to the standard execution options.
Parameter | Description |
---|---|
Choose the last | The desired number of records. Defaults to 1. |
Configure the Last N tool
Select the Last N tool.
Go to the Configuration tab on the Properties pane.
Enter the desired number of records in the Choose the last box.
Optionally, go to the Execution tab, and then set Web service options.