Skip to main content

Get Column

Retrieves all values from a specific column in a DataTable as an array. This node is useful for extracting column data for further processing, analysis, or iteration.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Input

  • Table - DataTable to get the column from
  • Column Name - Name of the column to retrieve

Output

  • Column - Array containing all values from the specified column (one value per row)

Example Usage

Extracting Email Addresses

// Table has columns: ["ID", "Name", "Email", "Phone"]
// 100 rows of customer data

var columnName = "Email";

// Get Column node extracts all emails
// Output: ["john@example.com", "jane@example.com", "bob@example.com", ...]
// Array length: 100

Processing Column Values in a Loop

// Get all product prices
var columnName = "Price";
var prices = /* Get Column output */;

// Calculate total
var total = 0;
for (var i = 0; i < prices.length; i++) {
total += parseFloat(prices[i]);
}

// Calculate average
var average = total / prices.length;

Finding Unique Values

// Get all cities
var columnName = "City";
var cities = /* Get Column output */;

// Get unique cities
var uniqueCities = [];
for (var i = 0; i < cities.length; i++) {
if (uniqueCities.indexOf(cities[i]) === -1) {
uniqueCities.push(cities[i]);
}
}

// uniqueCities = ["New York", "Los Angeles", "Chicago"]

Creating Lookups or Mappings

// Get IDs and Names
var ids = /* Get Column "ID" */;
var names = /* Get Column "Name" */;

// Create ID to Name mapping
var idToName = {};
for (var i = 0; i < ids.length; i++) {
idToName[ids[i]] = names[i];
}

// Usage: idToName["123"] returns "John Doe"

Validation and Data Quality Checks

// Get all email addresses
var emails = /* Get Column "Email" */;

// Check for invalid emails
var invalidEmails = [];
for (var i = 0; i < emails.length; i++) {
if (emails[i].indexOf("@") === -1) {
invalidEmails.push({
index: i,
value: emails[i]
});
}
}

// Report or fix invalid emails

Statistical Analysis

// Get all ages
var columnName = "Age";
var ages = /* Get Column output */;

// Find min and max
var minAge = Math.min.apply(null, ages);
var maxAge = Math.max.apply(null, ages);

// Count age ranges
var young = 0, middle = 0, senior = 0;
for (var i = 0; i < ages.length; i++) {
if (ages[i] < 30) young++;
else if (ages[i] < 60) middle++;
else senior++;
}

Exporting Specific Column Data

// Get column for export
var columnName = "ProductID";
var productIds = /* Get Column output */;

// Convert to CSV format
var csv = "ProductID\n";
for (var i = 0; i < productIds.length; i++) {
csv += productIds[i] + "\n";
}

// Write to file or send via API

Tips

  • The output array preserves the order of rows in the table
  • Array length equals the number of rows in the table
  • Works with any data type (strings, numbers, booleans, objects)
  • Use in combination with loops for row-by-row processing
  • Efficient for bulk operations on column data
  • For accessing specific rows, use Get Row node instead
  • Column values can be null or empty - handle these cases in your code

Common Errors

Empty Table Error

Error: Table cannot be empty. Please provide a valid DataTable.

Solution: Ensure you're passing a valid DataTable object from a previous node.

// Wrong - table is null or undefined
var table = null;

// Correct
var table = /* Valid DataTable from Create DataTable or other source */;

Empty Column Name Error

Error: Column name cannot be empty. Please provide a valid column name.

Solution: Provide a valid, non-empty column name string.

// Wrong
var columnName = "";

// Correct
var columnName = "Email";

Column Not Found Error

If you specify a column name that doesn't exist in the table, you'll get an error.

// Table has columns: ["ID", "Name", "Email"]

// Wrong - column doesn't exist
var columnName = "Phone"; // Error!

// Correct
var columnName = "Email";

Solution: Verify the column name exists in the table. Column names are case-sensitive.

// Check column names first
var table = /* DataTable */;
// Table columns are stored in table.columns

// Use exact column name
var columnName = "Email"; // Not "email" or "EMAIL"

Empty Table (No Rows)

Getting a column from a table with no rows returns an empty array, which is valid (not an error).

// Table with 0 rows
var emails = /* Get Column "Email" */;
// Result: [] (empty array)
// Length: 0

See Also