Loop through list of datatables and make changes

Hi,

I was looking for some help.

I have a number of datatables that i’m trying to loop through and make changes.
Although i can see the changes happening when I step though and view the locals panel, the changes are not saved in the outputs.

How can i fix?

The problem is caused by the Filter datatable activity.
It creates in the output NEW datatable object that not reference to the original object in the list.

This is solution proposed by ChatGPT:
To apply the changed datatable back to the original DataTables (dt1, dt2, dt3), you’ll need to replace the content of each original DataTable with the changed one.

' Define the array of DataTables
Dim dtArray() As DataTable = {dt1, dt2, dt3}

' Loop through each DataTable in the array and filter
For idx As Integer = 0 To dtArray.Length - 1
    ' Perform the filter operation and store the result in a temporary DataTable
    Dim filteredTable As DataTable = dtArray(idx).Select("[col1] = 100").CopyToDataTable()

    ' Clear the original DataTable and load it with the filtered result
    dtArray(idx).Clear()
    dtArray(idx).Merge(filteredTable)
Next

cheers

@qwerty1

Are you verifying the output datatable? Like the variables assigned to output tables only?

Cheers