Add Data Column: Object reference not set to an instance of an object

Hello I continued the workflow I had by putting an if there. but since then I am stuck and I ask for your help.on the message box, its shows me the json object below

After I put an if to check, And when my object does not contain a “message” I save it in a dataTable then write it on an Excel file

But arriving at Data Column I have this error “Add Data Column: Object reference not set to an instance of an object.”

I need your help to finish this project

@ppr Hi Sir i need your help a gain

@ppr @HareeshMR i need too your help

can you ensure that the datatable variable:

  • is initialized with new Datatable() (feel free tho share screenshot on it)
  • the scope of the variable is reachable whenn adding the column

the scope of the image is on the main sequence as shown in the image below. as for initializing I don’t know

on the variable panel for dtTable write new DataTable() to the default

1 Like

I kept the solution you made that I only put on an if statement

same for String list. Initialize it with new String() in the Default from the variable panel

now i have this : “Add To Collection: The property ‘Collection’ of ‘Add To Collection’ is not initialized.”

see my post above

1 Like

Its worked but i have this : " Add Data Column: A column named ‘datelivrance’ already belongs to this DataTable."

datacolumn name has to be unique. so check with an if or restructure your workflow that the datacolumns are added before. Do you add multiple “messages” or only one?


It is in a for loop when it adds the first object its pass, for a second object it puts this error

Yes I add several json objects having the same structure

yes sure. as mentioned a datacolumnname has to be unique. in such scenarios the datatable structure is built before (The recommended approach) or it is checked if datacolumn is already existing.


Checking if it exists, would it not be easier, because there I have just started with uipath and certainly there are these techniques I am not yet sure why I had asked for help. So what do you recommend to do? to make it work

can you share the xaml and the json data as text file with me. I will later have a look on it

1 Like

Main.xaml (12.3 KB)

Sorry for the time I was trying to deploy the lapi so that workflow works with you using the xaml file, I sent you by message the file it travels by direct message in zip file

Find an updated version now handling multiple within an JArray
abdouaziz_V2.xaml (11.9 KB)

Your JSON sample was not valid and required the surrounding to be a JArray. This updated file is sent to you by message.

1 Like

I wouldn’t know how to thank you Sir, not only for the time you took to answer me but to find a solution. I am very grateful, thanks, thanks and thanks again god bless you. You are an angel Sir. Thanks again. everything works fine