Merge Data Table: Object reference not set to an instance of an object

Why does it give this error on everything can UIpath think of any better error messages can anyone explain what this error means

Hi buddy,

Check this link: Error: Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value (not initialized)

The message " Object not set to instance of Object " means that you are trying to use an object which has not been initialized. That is, you either set it to null, or you never set it to anything at all. The runtime throwing a NullReferenceException always means the same thing: you are trying to use a reference .

In your Case , You are trying to Merge DataTable and Either one is Null

–
Mukesh

1 Like

So i have 5 datatables that i want to merge into one big one thats where i get that error do you know how i can merge all 5 datatables into one?

Hi @Johanvdv,

From where you are getting the 5 datatables…?

  1. Assign one finalDt= new datatable
  2. loop the datatables, use merge datatable inside the body
  3. In Merge Datatable, Destination --> finalDt and Source --> item

Thanks!

1 Like

So Before Merging all the 5 DataTables , Check if the Datatables are not blank .

This Can be Done as Shown Below.Below Code checks for DatTable Null or Empty

image

Also , Make sure the Final DataTable youa re Merging is Initialised as shown below

image

–
Mukesh

Thanks for the help. i found a way of doing it right after i asked the question

1 Like

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