How to Check For Null or Empty value in a Particular Column

Hello Guys,
I have to check a particular Column’s Cell values are Empty or Not.
If any one of its cell values are Empty Then It have to stop the entire process or Else it should move to next steps. Please Help me to Solve this.
Thanks in Advance

@mohamedalthaf
Welcome to the forum

isNothing(row(ColNameOrIndex)) OrElse String.IsNullOrEmpty(row(ColNameOrIndex).toString.Trim)

can be used e.g. within an if activity for checking if col value is null or blank

in case of we want to check if in the data table 1 or more rows are present with a blank in a particular column we do:

dtBlankDemo.AsEnumerable.Any(Function (x) isNothing(x(ColNameOrIndex)) OrElse String.IsNullOrEmpty(x(ColNameOrIndex).toString.Trim))
1 Like

Hi @mohamedalthaf

I think you re iterating datatable through for each row in datatable

Use Currentrow(“YourColumnName”).Tostring.Equals("") in if condition!

or String.isnullorEmpty(currentrow(“yourColumnName”).toString) in if Condition

Regards

Thanks @pravin_calvin
I tried this once…but bot ignores the particular cell with empty value and moved to next cell… For My process, If there is Any one empty cell in the column then it should stop the entire process.
is there any other way to solve this

Thanks @ppr
I tried this once…but bot ignores the particular cell with empty value and moved to next cell… For My process, If there is Any one empty cell in the column then it should stop the entire process.
is there any other way to solve this

which one you tried. We shared 2 options with you

I tried both

Hi @mohamedalthaf

Use try catch and inside try

reading the excel

looping the excel value based on column name

Use if Condition Currentrow(“yourColumnname”).toString.Equals("")

Then Throw a business Exception

and catch the Exception!

if the exception is catched it will stop the execution!

Regards

1 Like

snippet is running in many bots on production.

Can you share some more information on your implementation and to the data (e.g.Excel). Thanks

Thanks!! I will try this and let you know

@mohamedalthaf
find starter help here:
Check_dtHasBlanksIn_1Col.xaml (7.6 KB)

@ppr
Its Working Now
Previously I didnt Add Trim.
Its Woking after adding Trim at the End.
Thank you,

@mohamedalthaf
Perfect, just do your final testing and please close the topic by marking the solving post as solution. Thanks

Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

1 Like

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