Problem with Add Data Row

Ok … getting an error with Add Data Row that I don’t understand why I’m getting it as it doesn’t match what my arguments in Studio are showing. This is the error:

image

So my problem is the Add Data Row activity. This is how it is defined:

I’m using the DataRow and DataTable input arguments. This is what variables are currrently available:

As seen above, dataRow is a Data Row and dt_MatchWorkItems is a Data Table.

This is where I’m really confused. When I go into the Debug output frame and open up the message for running the Add Data Row activity I see this:

Look at the Arguments block … Why is the DataTable argument showing as null and not a Data Table when dt_MatchWorkItems is a Data Table ?

Is it because dt_MatchWorkItems is empty ?

What I’m basically doing is filtering a DT I passed in looking for specific rows whose columns match a simple check on values. If I find a matching row, I want to copy the entire row into the new DT and when done, pass that DT out for further processing.

I would imagine this is because the data row is empty. I might try adding an if statement to determine if the data row is empty. If so, continue without adding the row.

I figured it out. This posting helped: Copy Row from one DataTable to another

Turns out I needed to use a Clone() on the incoming DT to replicate its schema to a local DT. As soon as I did the clone, the object reference error went away but I got a “This data row is already a row in another table” or something close to that.

I found another posting related to that error. To address that, on the Add Data Row activity I needed to use the ArrayRow input argument with a value of “dataRow.ItemArray()”. I removed the value from the DataRow input argument. Now it works fine :slight_smile:

1 Like

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