I have three suggestions:
The Output DT needs to be defined if you are adding rows to it. i.e., the column names and the order of the addition of column values need to match.
We can keep the if logic simple (easy to comprehend) by using the
Index variable which is auto incremented in a For Each Row activity. This allows us to use the
<row number> ).Item("
<Column Name> ").ToString
In your case the if condition can be simplified:
row("Country").ToString.Trim = dtBook1.Rows(Index
- When adding rows to a table, the length of the array should be the same as the number of columns in the Output DT.
Here is the required output you are looking for (Output.csv). You have to change the input and output csv file paths to reflect your required file paths. Currently, it uses dummy csv’s.
I have also added a negative test case to test the workflow.
SolutionComparetwoCSV.zip (2.6 KB)
Alternative (a better solution):
To use the
Join Datatable activity to achive the same. It is much more elegant solution. All conditions would be specified within it and the workflow will be easier to read.
Hope this helps!