Add Table Row - Activities - Foundation 23.2 - Foundation 23.2 - Ready - Hyland RPA - external - Hyland-RPA/Activities/Foundation-23.2/Hyland-RPA-Activities/Developer/Data-table/Add-Table-Row - 2025-04-03

Hyland RPA Activities

Platform
Hyland RPA
Product
Activities
Release
Foundation 23.2
License

Developer.Datatable

Description

Adds a row to a previously created data table.

Properties

Analyst

  • Description: Optional text for documentation purposes.

Common

  • Disable Log: Disables the logging functionality for this activity.

  • Disable Protocol: Disables the protocol functionality for this activity.

Input

  • DataTable: The data table to which you want to add a row to.
  • Row Array: Set row array to add in curly brackets

    Example: {yourVariable1,yourVariable2} for a DataTable with two columns.

  • Table Row: If you already have a table row, for example, the output of a Find in Table activity, you can add this row here.

Example

For a usual DCO, you need InputData to pass over to the task. After using the Create Table activity to initialize the already existing argument InputData, the data table needs to be filled with information.

A possible use case is collecting e-mails and therefore storing mail IDs. For every e-mail, the Get Unique Mail ID activity is used and afterwards, the mail ID is passed to the data table InputData. Because every task has only one mail ID, that means one entry in the data table, the data table is cleared with the Clear Table activity at the end of each iteration.

Tips and Tricks

  • If you want to add your current DataRow to a different table, for example in a For each loop activity, you can simply use the property ItemArray, which returns all entries as an array of type object. You can use this object directly in the Row Array property of the Add Table Row activity.
  • Suppose you want to add a row to a DataTable you are currently iterating over. This operation is not allowed within a For each Loop activity, since you are trying to modify the length of your collection at runtime of the loop. In this case, you can use a Do While loop with the original row counts as the upper limit, setting counter < rowCount as a condition for the while loop, and drag and drop the Add Table Row activity into this loop.

rowCount = dtOriginal.Rows.Count 

Troubleshooting

  • Issue
    NullReferenceException: Object reference not set
    to an instance of an object:
    The data table is not initialized. Use a Create Table or Read Range activity before using the Add Table Row activity.
  • Issue
    ArgumentException: This row already belongs to another table:
    The row you are trying to set belongs to another data table. It is not possible to copy one row to another table since the Data Row instance is tied to its owning DataTable. The tips and tricks sections show you one example of how you can copy a row from one DataTable to another.
  • Issue
    InvalidOperationException: Collection was modified; enumeration operation might not execute.
    If you want to add a row to a DataTable you are currently iterating over, this is not possible within a For each Loop activity since you are trying to modify your iterator at runtime of the loop. The tips and tricks sections show you one example of how you can add a row while looping.
  • Issue
    ArgumentException: Input array is longer than the number of columns in this table.
    You tried to add an array with more entries than your DataTable has columns.
    • Check whether your DataTable contains all relevant columns and add missing columns if required.
    • Check whether you included too many entries in your row array and delete the unnecessary entries if required.
  • Issue
    Cannot set column 'MailId'. The value violates the MaxLength limit of this column.
    If you are using data-tables, the default added column or /row is defined as string with a maximum length of 100. Remove the default column or row and add a new column or row. This will have max as length.