How do i know if a cell is empty?

excel
activities

#1

Between the various conditions of a " if" I have to enter if the cell is empty

example

x<1 or x>2 and y.ToString.???

I looked for “isEmpty” but there is not


#2

string.IsNullOrEmpty("")
check this…?


#3

isNullOrEmpity("") is not member of uipath.generic.Value…I assign to Y value “generci”, because if I assign "string"
I have another mistake beforehand, in “read cell”


#4

Hey,
If you want to check if the variable is empty then
string=nothing

if you want to check if the variable just contains an empty string like “”, then
string=""

I think those should work.

Thanks.


#5

what mistake your referring to? You just have to do proper conversion .:wink:


#6

Hi,

please, give me an advice…

I want find first empty cell and paste to this empty cell (under the existing data) new data. But my robot doesn’t work well

Thank you in advance for your help :slight_smile:


#7

Hi @vhlavacek
=nothing or Is Nothing will only check if the variable has something stored in it.

What you really want is ="" , so the empty quotes means empty string
aHodnota.Trim = “”

Hope that helps.

Regards.


#8

To check if string is empty, you can also use:
aHodnota.Trim = Convert.ToString(DBNULL.Value)


#9

Hi @ClaytonM,

thanks for your advance… :slight_smile: Just “” I tried before, but my robot still didn’t work.

I’m sorry, but I don’t know what to do next.


#10

Sorry,
Since it’s a Generic Value you need a .ToString

aHodnota.ToString.Trim = ""
aHodnota.ToString.Trim = Convert.ToString(DBNULL.Value)


#11

Hi
If anyone know how to solve this. as I got the same problem.

4-21-2018%204-58-34%20PM

I tried to read from excel. phone number
if the colume phone got number (set as generic variable), paste the variable to the container in aother app.
otherwise go to next container for example email…

it give me error

4-21-2018%204-59-54%20PM

many thanks


#12

Hi,

The “Object reference not set…” error means your variable used, phone, has no value stored in it. So I’m guessing that the Read Cell to store a value in phone did not execute. We would need to see how you are storing the phone variable before the If activity.

Alternatively, you can store the default value of the phone variable in the variable section. Just put “” in the default value in variables. That way, even if nothing gets stored to the variable it will have an empty string

Regards.


#14

Hi
thank you
I find another topic which is similar and it works now.
thanks