Adding null condition in Data Table

excel
activities
studio

#1

Hi RPA Devs,

I have a problem, i want to get all the value from the excel and transfer it to the data table however i want to put a condition that will not get the value of the row if it is equal to NULL or “”.

I keep getting an error. NullReferenceException.

Hope someone can help me with this.

image

Thank you.

Regards,
Cedrick


#2

Hi @Cedrick_Julian,

where you are getting the NullReferecenException, during the condition check UnappliedBalance.Equals("")?

what is the UnappliedBalance variable type?


#3

Hi, I had a similar issue but fixed it by using a select on the datatable to only get the rows I want, for example

RFCDT.Select(“UnappliedBalance<>’’ or UnappliedBalance is not NULL️”)

You then get an array of datarows that you can iterate over or make a new datatable.


#4

hi @Cedrick_Julian

you can check it with this

if(UnappliedBalance.IsNull orEmpty)

Thanks
Ashwin S


#5

Hi Sir Bob,

Wow, Just amazed that you are very hands-on on this.

Thank you very much Sir very much appreciated, we will apply this suggestion and will let you know.

Thank you.

Regards,

Cedrick


#6

Hi Sir Ashwin S,

Thank you for the help, very much appreciated.

will test this suggestion too.

Regards,
Cedrick


#7

Hi @Cedrick_Julian,

check in if condition string.isNullorEmpty(yourvalue)

Regards, Arivu:-)