Add Row
Adds a new row to an existing DataTable. You can provide row data either as a dictionary object via input or define it using the Custom Row option in the node properties.
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.
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 add the row to
- Row - Dictionary containing column names as keys and their corresponding values
Output
- Table - Updated DataTable with the new row added
Options
- Custom Row - Define row data using the visual editor
- Each entry has an Option field (column name) and a Value field
- Alternative to using the Row input
- If the column doesn't exist, it will be created automatically
- Useful for defining static rows or when you prefer the visual interface
Example Usage
Adding a Row with Dictionary Input
// Create a row as a dictionary
var row = {
"Name": "John Doe",
"Age": 30,
"Email": "john@example.com",
"City": "New York"
};
// Add Row node will append this row to the table
Adding Multiple Rows in a Loop
// Process multiple records
var customers = [
{ name: "Alice", age: 28, email: "alice@example.com" },
{ name: "Bob", age: 35, email: "bob@example.com" },
{ name: "Carol", age: 42, email: "carol@example.com" }
];
// Use a loop with Add Row node
for (var i = 0; i < customers.length; i++) {
var row = {
"Name": customers[i].name,
"Age": customers[i].age,
"Email": customers[i].email
};
// Add Row node processes this
}
Using Custom Row Option
Instead of passing a dictionary through the Row input, you can use the Custom Row option:
- Open the node properties
- Click Add in the Custom Row section
- For each column:
- Option: Enter the column name (e.g., "Name")
- Value: Enter the value (e.g., "John Doe")
- The row will be added with the specified values
Adding Rows with Partial Data
// Table has columns: ["ID", "Name", "Email", "Phone"]
// You can add a row with only some columns populated
var row = {
"ID": "001",
"Name": "Jane Smith",
"Email": "jane@example.com"
// Phone is not provided - will be empty/null
};
Dynamic Column Creation
// If Custom Row defines a column that doesn't exist, it's created automatically
// Existing table columns: ["Name", "Age"]
// Using Custom Row option:
// Option: "Name", Value: "Mike"
// Option: "Age", Value: 25
// Option: "Department", Value: "Sales" <- New column created
// Result: Table now has ["Name", "Age", "Department"]
Tips
- Use dictionary input for dynamic, programmatic row creation
- Use Custom Row option for static, predefined rows
- Column names in the row dictionary must match existing table columns (unless using Custom Row option)
- Missing columns in the row dictionary will have empty/null values
- You can add rows in loops for bulk data insertion
- Both Row input and Custom Row can be used together - Custom Row is processed after Row input
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.
// Make sure table is initialized
// Wrong: table is undefined or null
// Correct: table comes from Create DataTable or other DataTable node
Empty Column Name in Custom Row
Error: Column name cannot be empty. Please provide a valid column name.
Solution: When using Custom Row option, ensure all Option fields have valid column names.
Wrong in Custom Row:
Option: "" (empty)
Value: "Some value"
Correct:
Option: "Status"
Value: "Active"
Column Mismatch
When using the Row input (not Custom Row), if you reference a column that doesn't exist in the table, you may get errors. Always ensure your dictionary keys match the table's column names.
// Table columns: ["FirstName", "LastName", "Email"]
// Wrong - typo in column name
var row = {
"FistName": "John", // Typo!
"LastName": "Doe"
};
// Correct
var row = {
"FirstName": "John",
"LastName": "Doe",
"Email": "john@example.com"
};
See Also
- Create DataTable - Create a new table
- Remove Row - Remove rows from a table
- Get Row - Retrieve specific rows
- Add Column - Add columns to a table