Need to compare 2 datatable and write a value in another datatable by particular column.
Here, i need to compare the 2 datatable by country column and if the country name is not available in another table write 0 in that appropriate cell and continue comparing to next and so on.
Can be done e.g. with join datatable activity. So give a try on following.
Prepare a target datatable with build datatable activity having Columns: Country, Prev, Current - dtTarget
Use Join DataTable: dt1 - prev week data, dt2 = current week data, Join Type: Full, Output: dtJoin | Join Columns = Country | Operation: =
Aftwerwards process the join result by
Assign activity
LeftSide: dtTarget
Righ side:
(From d in dtJoin.AsEnumerable
Let c = If(String.IsNullOrEmpty(d("Country_1").toString, d("Country)", d("Country_1"))
Let pr = If(String.IsNullOrEmpty(d("Users").toString, "0", d("Users"))
Let cr = If(String.IsNullOrEmpty(d("Users_1").toString, "0", d("Users_1"))
Let ra = new Object(){c,pr,cr}
Select dtTarget.Rows.add(ra)).CopyToDataTable