While clearing a copy of a datatable, the original and the copy gets cleared.
Steps to reproduce:
Initialize a datatable (say DT1) with some content (I used a Read Range activity to read from excel and store in datatable)
AssignDT2 = DT1
Clear Data TableDT2
Current Behavior:
Both DT1 and DT2 become null
Expected Behavior:
Only DT2 should become null
Studio/Robot/Orchestrator Version:
Last stable behavior: NA
Last stable version: NA
OS Version: Windows 7
Others if Relevant: (workflow, logs, .net version, service pack, etc):
UiPath.System.Activities v19.3.0
I believe this is an issue of the assignment being by reference instead of by value. When you’re doing your assignment DT2 = DT1, you’re not doing an actual copy of the data. Both variables at that point, DT2 and DT1 are pointing to the same DataTable. So any changes done with one will be reflected in calls to the other.