I want to add multiple rows to a DataTable I've created

Thank you for your continued support.

Is it possible to add multiple rows at once to a table created using Build Data Table?

Currently, the following process within a loop works:
1.Build Data Table
2.Extract Table Data from the application to get a data table
3.Filter Data Table to narrow down the results
4.Add only the first row to the data table created in step 1 using Add Data Row

However, step 3 is no longer necessary, and I need to store all the rows in the data table.

I’m sorry I can’t provide screenshots or other materials, which may make this difficult to understand.
I’d appreciate any advice you can offer.
Thank you.

Hello

If the schema of DataTable 1 is the same as that of the DataTable extracted from the table, then specifying 1 in the “Input DataTable” property of the table extraction activity will automatically add it. (If repeating this, you need to set the previous output here.)

The properties may differ depending on the type of table extraction activity. (For IN/OUT types, specify 1 there.)

Alternatively, there is also a MergeDataTable activity, so you could merge them that way.

Hi @Teo,

As @Yoichi mentioned, the Merge Data Table activity is the easiest way to replace your Add Data Row step here. Just set the Source property to the DataTable from Extract Table Data, and set Destination to the DataTable you created in Build Data Table. That will append all extracted rows at once without needing a loop.

One quick thing to watch out for is the column structure—if the column names and types match between both tables, Merge Data Table works right out of the box (you can set MissingSchemaAction to Ignore if you only want to keep the columns defined in your Build Data Table). If the column names are different, you can instead use a For Each Row in Data Table on the extracted table and place Add Data Row inside it, passing CurrentRow.ItemArray into the ArrayRow property.

Also, just make sure your Build Data Table activity is placed outside (before) your main loop so the accumulated rows don’t get reset on each iteration.

Hope this helps!

Hi @Teo,

@Yoichi and @MayureshOfficial_45 already covered the two main ways (Input DataTable on Extract Table Data, and Merge Data Table). Since you’re in StudioX, one quick practical detail that trips people up when merging extracted web tables into a custom Build Data Table:

  1. Make sure the column types match, not just the names: Extract Table Data outputs every column as String by default. If your Build Data Table has Int32 or DateTime columns, Merge Data Table will throw a type mismatch error unless both tables use matching column types (or you map/convert them inside a For Each Row in Data Table + Add Data Row).

  2. Don’t even need Build Data Table if you just want to combine multiple extractions: You can initialize your master table directly from the first extraction (or pass the same DataTable variable into both the Input and Output properties of Extract Table Data inside your loop), and it will keep appending rows automatically.

  3. Keep initialization outside the loop: Place Build Data Table (or your initial table setup) before the loop—otherwise it resets to 0 rows on every iteration.

Maybe restarting the workflow could help.

@Yoichi,
Thank you as always.

I couldn’t figure out the table extraction properties, but it looks like I can achieve what I have in mind by merging data tables! Thank you.

@MayureshOfficial_45
Thank you for your advice.
I think I may be able to do what I want using the Merge Data Table activity.
Thank you for taking the time to explain.

@jagdish
Thank you for the detailed and clear explanation.
It looks like I may be able to do what I want using the Merge Data Table activity, so I’ll give it a try.
Thank you.

Glad to help, @Teo! Thanks for marking the solution, and feel free to ask if you hit any snags with the Merge Data Table setup.

This may be helpful. The table extraction activity and its configurable properties vary depending on the version of the UiAutomation activities package. The above is the latest version; if you’re using a slightly older version, it should look like this.
If you set this DataTable property to a DataTable that already contains values, the table extraction activity will automatically merge the extracted data with the existing data. (However, the schemas of the input data tables must match.)

@Yoichi,
Thank you very much for your kind response.
I’ll give it a try!