Getting the [Object Reference Not Set To An Instance Of An Object] error

Hello,

I am working on rpa challenge practice which is in rpa developer foundation.

When I download solution of practice. I works well without issue. But when I do the same with solution from scratch I am having the [Object Reference Not Set To An Instance Of An Object] error. I tried to solution which you described above. But I could not succeed. Can you please help me to fix this issue. I can not continue without understanding and solving the issues.

Hi @Ekrem_KARAMAN,

Looks like UsersDT is blank, please check that you’re reading/getting data into that variable correctly. If you’re reading an excel file then the file might be blank, or you might not have assigned UsersDT to the output.

1 Like

Your datatable has no rows and was never initialized.

Go to your variables panel and in the default for UsersDT type:

new system.data.datatable

That makes sure it is initialized by default.

1 Like

Thank you for your response…

Actually, I am doing as same as the source of uipath which I download from the academy. And I couldn’t understand actually why we put there variable which we never mention again. As you say maybe I have to assign it somewhere where I couldn’t see it…

Maybe this is the most simple thing but if you can help me to understand I will be glad

I made it as you mention but still same issue. God I am going out of my mind soon :slight_smile:

That is not what I suggested you do. That is the datatype of the variable. To the right there is a column named Default. In the Default value for UsersDT type:

new system.data.datatable

Hello @Ekrem_KARAMAN ,

Could you please check whether any data is there in the datatable “UsersDt”.

Use output datatable acitvity and convert datatable to string variable and print it in a message box.

I suspect the Datatable “UsersDt” is blank. Please check this.

Debug would be a better way to do it. Set a breakpoint on the For Each then Debug the file. When it pauses, look in the Locals panel.

He can use any methods but finally the intention is to cross check “UsersDt” is not empty.

Somewhere during the extraction the data is not fetched properly.

I forgot to put output of read range variable now it pass that part. But couldnt find the column name i dont know why :slight_smile:

Plz check whether you have enabled Has header in the read range activity and confirm the column name doesn’t have any unwanted space

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