AddDataRow using row.ItemsArray and Write range error

Hello,

I am reading csv1 to find a client ID in a csv2 and if found, add column to correct row in csv2, or in this case, i have create a Final.csv with the full line.

So far so good until it is time to write each row where a client in csv1 is found is csv2.

i made a test and message box told me 3 time that they found the 3 corresponding number.

But when i try to write wrange, i get : AddDataRow: Object reference not set to an instance of an object.

Attached are screenshot, maybe you will find my mistake or will direct me to another question i didn’t find with the correct answer.


ensure DTFinal is intialized befor usage and is having the correct columnstructre as well
this can be achieved eg. by placing an assign activity befor the for each row in table activity

with: dtFinal = DTFournisserInvoice.Clone

1 Like

@Nicolas_Lamoureux Can you initialize the DTFinal data table as New System.Data.DataTable. Below screenshot for ref

1 Like

@Nicolas_Lamoureux
keep in mind only init a new Datatable will miss the needed datacolumns structure
So it is up to your decission, to do it afterwards or directly with the clone method

1 Like

@ppr and @Ush : You were both exactly right. TANXS!

now, i just need to learn how to add a new column containing the corresponding info from CSV1 . But now, i have a start. I know my system recognize where they are pairs in both document, now i need to add to my CSV2 a column with the missing info from CSV1.

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