Skip to main content
Skip table of contents

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.

Note that 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:

Choose the first

The desired number of records. Defaults to 1.

Configure the First N tool

  1. Select the First N tool, and then go to the Configuration tab on the Properties pane.

  2. Enter the desired number of records in the Choose the first box.

  3. Optionally, go to the Execution tab, and then set Web service options.

    image-20240328-182205.png

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.

Note that 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:

Choose the last

The desired number of records. Defaults to 1.

Configure the Last N tool

  1. Select the Last N tool, and then go to the Configuration tab on the Properties pane.

  2. Enter the desired number of records in the Choose the last box.

  3. Optionally, go to the Execution tab, and then set Web service options.

    image-20240328-182247.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.