How do i know if a cell is empty?

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

string.IsNullOrEmpty("")
check this…?

1 Like

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”

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.

1 Like

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

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:

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.

1 Like

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

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.

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

aHodnota.ToString.Trim = “”
aHodnota.ToString.Trim = Convert.ToString(DBNULL.Value)

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

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.

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

Hi All,

For me non of above worked, however this did:

string.IsNullOrEmpty(var.string)

1 Like

Hi , could any one help me
i need to know how could i get the the order for last cell in a column , in other word the order for the first empty cell in a specific column
as i need to take copy column from a sheet its column length is variable accordingly the order for last cell will be variable also and past it in another worksheet

Copy past function is easy but i use to identify for the robot the end of the column each time , the problem that i need to ask the robot to read the column as it without identify the ending point
Example : A2:A16
A16 is variable each time i use the robot , maybe A20 maybe A10

image

Thanks very much

Try if string_var = “null”

Hi @FreddyMounir - Try to read cell and store that output into a variable. Then check that variable = “”

Regards,
AK

Read the cell value(say Read Cell activity) and store in variable e.g.; cellValue . Then using If condition activity, check for string.IsNullOrWhiteSpace(cellValue).

If the current cell is an empty cell, it will recognize it and you can take further action.

P.S.: Sorry probably its too late now, just realized its an old post.!

4 Likes

@sawaseem, is never too late. is helps me

1 Like