Replacing value in column of row variable edits datatable

This is either a bug, or I’m missing something fundamental.

We have a process where a row is selected from a datatable. That row (system.data.datarow) is sent as an in argument to an invoked workflow. Within that invoked sequence a particular column value is potentially edited before the datarow is sent further into the process.

Once the transaction is done the process exits the invoked sequences (back to “main”) where a new transaction is picked up (a modified version of the REF framework). The datatable (with scope in main) has now been edited, the value of the row and column that was edited within the scope of the invoked workflow has somehow made its way into the main datatable.

Depending on the characteristics of the transaction a new row from the datatable is assigned to the datarow variable. If the same row from the datatable gets selected the modified value of the edited column follows along, and causes major issues. We had this error in production for a while before it was discovered.

Please advice - bug? How to fix (beyond reading a fresh datatable with read range for each transaction)? If not a bug, how can an edited datarow variable in a different scope that main datatable affect the main datatable?

Please find attached workflow where the bug is reproduced.

Test.1.0.1.nupkg (36.3 KB)

Hi @HBenum
Can You share an screenshot of the issue ou are facing

Hi Dinesh,

Thank you for your quick reply. Its a bit hard to share as a screenshot, but I’ll try with a series of screenshots.

Here is a screenshot taken during the first iteration, when the datarow variable is assigned from the datatable variable

Within the invoked workflow the value of one of the items of the datarow variable is edited:

Now comes a screenshot from the second iteration, when the same row from the datatable is assigned to the datarow variable - only now, the value in the colum that was edited for the datarow has somehow carried over to the DATATABLE.

Please advice if there are other screenshots I should attach to make clear the issue I’m facing.

Hi @HBenum

Please check the variable data in the local panel and please ensure you give the correct directions for the argument as you expected

Within the invoked workflow the only variable is the row_in_variabler. Once the workflow exits, and the datatable is once again within the scope, the datatable has been modified.

I added a log message to showcase what occurs:

Here is how the datatable looks after the datarow has been edited within the invoked workflow:

HI,

It seems normal behavior. DataRow is reference type variable and has information for parent DataTable, and if you update the datarow, it reflect the DataTable even if ArgumentType is In.

Can you also chekc the following sample?

Sample
Sample20231107-4L.zip (4.1 KB)

Regards,

I guess I was missing something fundamental then! Thank you for clearing that up, never occured to be that the datarow referenced the datatable in that manner.

I also tried to modify so that the datarow is selected from a temp datatable that is assigned fresh for each iteration from the main datatable - but the main datatable is still changed by modifications to the datarow variable… Still find this weird :smiley: But, now that I know how it works I can work around it!

Thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.