When we use And, Andalso, or, orelse

I have 3 condition for if. Which is better for me to use? I have data like this

Name Email Phone Title
John gmail 7777 Employee
Doe gmail
kelvin

With this condtion i want the result show which data only have email, data have no email and phone but have title etc

HI,

How about the following? This sample assumes “Name” always exists (excluded from the evaluation)

data only have email,

Not String.IsNullOrEmpty(row("Email").ToString) AndAlso String.IsNullOrEmpty(row("Phone").ToString) AndAlso String.IsNullOrEmpty(row("Title").ToString)

data have no email and phone but have title

String.IsNullOrEmpty(row("Email").ToString) AndAlso String.IsNullOrEmpty(row("Phone").ToString) AndAlso (not String.IsNullOrEmpty(row("Title").ToString))

Sample20221125-4.zip (4.7 KB)

Regards,

Hi @Yoichi thanks for the answer, i do have a condition already same like u give to me. Now i have 2 Question that is

  • Why u use andalso? what is difference if i use and
  • Is it possible to do multiple condition using Else If? so i dont need to add if acitivity one by one

Hi,

Why u use andalso? what is difference if i use and

AndAlso is short-circuiting logic. If the first expression returns false, behind expressions are never evaluated. In most case, it’s better than And because of performance.

Is it possible to do multiple condition using Else If? so i dont need to add if acitivity one by one

Yes, we can use Else if as the following.

Hope this helps you.

Regards,

Hello @Kelvin1

Once you checked the data and if any data is missing, do you need to perform separate work around or you just to check whether the data is missing in the datatable?

If first case for each column you will have to write separate elseif (inside elseif activity)

Thanks

hi @Rahul_Unnikrishnan once i checked the data i want to write information which name has no email phone etc

Hi @Yoichi thanks for the answer

1 Like

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