Compare two values and transfer line

Hello all,

I have two datatables that I am comparing. As soon as a value is missing, it should be written as a whole row in the other table. The problem is that I get all rows written into the table and not only the corresponding one that is different. How can I achieve this?

i tried this in the ArrayRow but it doesnt work

SCID_group.Item(SCID_count).Rows(row).ItemArray

Hi @NHoe ,

Could you check if the Condition you are using is accurate?
Because the step you are using to add rows to another DataTable seems fine.

image

Dt.Rows(Idx).ItemArray.ToArray() -> ArrayRow in Add DataRow Activity

Kind Regards,
Ashwin A.K

Hi, I have checked that.

I read in the original file and the comparison file and check the value via read Column. In the condition I query the following.

Column_ServiceCase.Contains(ServiceCase)
Read Column

Hi @NHoe ,

Alright, could you try adding a Breakpoint at the Add DataRow Activity just to get an idea of how the logic is currently flowing and to pinpoint the potential cause of error?

If you can provide us with some sample data, that would put us in a much better position to assist you.

Kind Regards,
Ashwin A.K

here the Screenshot from the Breakpoint

Hi @NHoe ,

Its still a little difficult to tell exactly what the issue is, so here is a short workflow I developed that could potentially address this.

Simply pass in the column name of the two DataTables that you will to check

Assign->

str_columnNameDt1 = "columnName1"
str_columnNameDt2 = "columnName2"
(From row1 In dt1.AsEnumerable()
Group Join row2 In dt2.AsEnumerable()
On row1(str_columnNameDt1).ToString.Trim Equals row2(str_columnNameDt2).ToString.Trim Into gj = Group
From g In gj.DefaultIfEmpty
Where IsNothing(g)
Select row1).CopyToDataTable()

WriteDataNotFoundinDt1.xaml (9.8 KB)

Kind Regards,
Ashwin A.K

Your solution works at first sight, but it copies the already existing value, but I need all values that are unequal.

You could try playing around with the conditions in this snippet of code

(From row1 In dt1.AsEnumerable()
Group Join row2 In dt2.AsEnumerable()
On row1(str_columnNameDt1).ToString.Trim Equals row2(str_columnNameDt2).ToString.Trim Into gj = Group
From g In gj.DefaultIfEmpty
Where Not IsNothing(g)
Select row1).CopyToDataTable()

Also I’ve made a slight error, please rectify that and see if it works as expected:

image

Here is an updated workflow with dummy data.

WriteDataNotFoundinDt1_v1.xaml (17.9 KB)

Kind Regards,
Ashwin A.K

I have rebuilt my initial situation, because in both solutions the value is not taken over correctly.

Main.xaml (29.7 KB)

@ashwin.ashok Unfortunately, both variants do not work as desired