Getting an error as "Object reference not set to an instance of an object"

While I’m debugging the workflow, I’m getting an error as “Object reference not set to an instance of an object” . Why? How to fix this issue?

Please find the screenshot below:


Can anybody help me in this issue?

Thanks
Vignesh.S.M.

@vignesh_S.M

Is the datatable initialized?

Nee datatable is how you initialize

The error comes when any of the variable is not initialized

Cheers

Hi @Anil_G

How to initialize it?
Please find the screenshot below:

Thanks
Vignesh.S.M.

In Assign Activity give In_dtReport value as New System.Data.Datatable.

Please refer

@vignesh_S.M

In the default value give New DataTable for initialization…but I see it as an in argument…why did you add as in if you dont have data?

Better use a build datatable activity and add the columns you need…that way it gets initialized with required columns

Also its better to checkither variables you are using as well…

Cheers

Use the Build Datatable activity to initialize the table.
Specify the columns present in the table and (optional) also add any default rows you want to add during initialization.

as per your screen shot

you are clearing datatable with invoke method activity

in next step you are adding the data row

by the argument naming (in) we can assume that is passed from other work flow

can you elaborate what exactly you want to do?

Regards

Hi @LAKSHMI_NARAYANA_PEMMASAN

you are correct…
Actually I have passed it from other workflow only…
Please find the screenshot below:



So, where exactly we should initialize this datatable?

Thanks
Vignesh.S.M.

what you are passing to the add data row?

can you check if they has any values or not ?

As you are using invoke method to clear the table, means it should have already some data and clearing the data so mostly guess is it should not related to table null reference

so better check the values you are passing to data row

Regards

Thanks @LAKSHMI_NARAYANA_PEMMASAN .

Let me check…