Skip to main content
All CollectionsTransformations
Transformation: Insert row numbers
Transformation: Insert row numbers

Add sequential row numbers to your dataset using the Insert Row Numbers transformation.

Quin Eddy avatar
Written by Quin Eddy
Updated over 2 weeks ago

The Insert Row Numbers transformation in Nexadata Pipelines allows you to add a new column that sequentially numbers each row in your dataset. This transformation is useful for assigning unique identifiers or systematically ordering data. You can configure this transformation using Natural Language Mode or Advanced Mode.


Inputs for Insert Row Numbers Transformation

  1. Name of the Transformation: In Natural Language Mode, the transformation name is automatically generated, but it can be updated later using Advanced Mode. For example, you might rename it to something more descriptive, like "Row Number Generator".

  2. New Column Name: Enter the name of the new column that will store the row numbers (e.g., "Row Number," "ID," or "Index").

  3. Position of New Column: Specify where the new column should be placed in the dataset:

    • First: Insert the new column at the beginning.

    • Last: Add the new column at the end of the dataset.

    • Before or After: Insert the new column before or after a specific existing column.

  4. Reference Column: If you choose to position the column Before or After another column, you will need to select a reference column that will serve as the insertion point for the new column.


Using Natural Language Mode

In Natural Language Mode, you can define the transformation with a single, simple instruction. Nexadata will automatically interpret the input, create the transformation, and assign it a default name. If needed, the transformation name can be modified later in Advanced Mode.

Example Instructions in Natural Language Mode

  • Prepend a new column labeled Employee_ID and populate it sequentially with unique identifiers starting from E1001 for each record in the dataset.

  • Insert row numbers at the beginning of each row in the dataset.

  • Add a new column called Row Number to sequentially number each entry.

  • Number each row starting from 1 in the Row Number column.

  • Create a column named Index to insert row numbers for all rows.

Note: While Natural Language Mode provides a quick and intuitive setup, the transformation name and other settings can be adjusted using Advanced Mode if necessary.


Using Advanced Mode

In Advanced Mode, you have full control over the transformation setup through a detailed UI. This mode allows for more precise configuration, including the ability to rename the transformation, modify the new column name, and select its position in the dataset.

Steps in Advanced Mode

  1. Name of the Transformation: Enter or update a custom name, such as "Row Number Generator", especially if the name generated in Natural Language Mode needs refinement.

  2. New Column Name: Define the name for the new column where the row numbers will be inserted (e.g., "Row Number", "ID", "Serial Number").

  3. Position of New Column: Choose where to place the new column:

    • First: Insert the new column as the first column in the dataset.

    • Last: Add the column at the end of the dataset.

    • Before or After: If choosing Before or After, you’ll need to select a reference column to specify where the new column should be inserted relative to existing columns.

  4. Reference Column: Provide a reference column if selecting Before or After.

Example in Advanced Mode

  1. Name of the Transformation: Row Number Generator

  2. New Column Name: Row Number

  3. Position of New Column: Before the "Order ID" column

Advanced Mode offers flexibility to fine-tune the configuration, including renaming the transformation and adjusting the new column’s placement.


Example Use Case

The Insert Row Numbers transformation is particularly useful when you need to assign unique identifiers to each record in a dataset. For example, imagine you have a dataset of customer orders, and you want to assign sequential row numbers to each order for easier tracking and referencing. For example:

  • Transformation Name: Order Row Number Generator

  • New Column Name: Order_ID

  • Position of New Column: First

In this case, you would create a new column named Order_ID at the beginning of the dataset that assigns a sequential number to each order, starting from 1. This transformation is useful for processes that require a unique ID for each row, such as reporting, data validation, or indexing records for further analysis.


Summary

The Insert Row Numbers transformation in Nexadata Pipelines provides an efficient way to add a sequential identifier to each record in your dataset. Whether you’re numbering customer orders, transactions, or any other dataset, this transformation helps ensure that every row is easily identifiable. Use Natural Language Mode for a quick setup or Advanced Mode for precise control over the transformation settings, including the position of the new column.

Did this answer your question?