Multiple AND Conditions

Hi All,

The following expression is correct? Kindly let me know. My scenario is CurrentRow(“Region”) should be equal to (“AMER”) and CurrentRow(“Business Unit”)should be equal to (“AMER Enterprise”) and
CurrentRow(“Account Name”) should be equal to (“split_accountname”)

CurrentRow(“Region”).ToString.Equals(“AMER”) And CurrentRow(“Business Unit”).ToString.Equals(“AMER Enterprise”) AND CurrentRow(“Account Name”).ToString.Equals(“split_accountname”)

Hi @dutta.marina

Keep the open and close braces for every expression like below.

(CurrentRow(“Region”).ToString.Equals(“AMER”)) AND (CurrentRow(“Business Unit”).ToString.Equals(“AMER Enterprise”)) AND (CurrentRow(“Account Name”).ToString.Equals(“split_accountname”))

Regards,

Hi @dutta.marina

It is also a good idea to trim and upper o lower the comparision in order to ignore not desired whitspaces or capital letters, you can add them like this

CurrentRow("Region").ToString().Trim().ToUpper().Equals("AMER") AndAlso CurrentRow("BUSINESS UNIT").ToString().Trim().ToUpper().Equals("AMER Enterprise") AndAlso CurrentRow("Account Name").ToString().Trim().ToUpper().Equals("SPLIT_ACCOUNTNAME")

Regards

Hi fernando,

Its not working. I tried the condition

Hi Lakshmana,

I tried using brackets. Its not working

Hi @dutta.marina

What are you trying to accomplish? because the expression is correctly wrote

Regards

Could you send the ss of that process

Can you share an example with input table to elaborate. Your code should work.
If you want to compare LHS ie. values in your fields with values on RHS and the actual value contains braces as well, only then you would need to use escape sequences.
Example to demonstrate your requirement through input will help to solve your problem

Hi Chetan,

I am sharing my code along with file so that its easy to understand what i am doing . I am trying to read google sheet and create folders in google drive . I need to check each row and if it matches move file to respective account name .

Google_Drive_Folder_Creation (3).zip (46.7 KB)


Google_Drive_Folder_Creation (3).zip (46.7 KB)

There’s not a row with “Account Name” = “split_accountname”.

I have used like this. Is this correct?

(CurrentRow(“Region”).ToString().Trim().Equals(“AMER”) AndAlso CurrentRow(“Business Unit”).ToString().Trim().Equals(“AMER Enterprise”) AndAlso CurrentRow(“Account Name”).ToString().Trim().Equals(“split_accountname”))

Hey!

Can you try this:

CurrentRow("Region").ToString.Trim.ToLower="amer" AND CurrentRow("Business Unit").ToString.Trim.ToLower="amer enterprise" AND CurrentRow("Account Name").ToString.Trim.ToLower="split_accountname"

Regards,
NaNi

The full clause looks valid. I was just pointing out, that in the screenshot of your sample data, there’s not a row that matches this part:

CurrentRow(“Account Name”).ToString().Trim().Equals(“split_accountname”)

Hence the condition will evaluate to False when evaluated in runtime.

Totally unnecessary to have the extra parentheses around each expression.

When you’re putting methods together with dot notation you don’t need the ().

YourVar.ToString.Trim is all you need, not YourVar.ToString().Trim()

Hi @dutta.marina

Can you try this-

CurrentRow(“Region”).ToString.Equals(“AMER”) And CurrentRow(“Business Unit”).ToString.Equals(“AMER Enterprise”) And CurrentRow(“Account Name”).ToString.Equals(“split_accountname”)

Thanks!!

@dutta.marina

Everything looks good. I believe this SPLIT_ACCOUNTNAME is a variable …if so use as below

CurrentRow("Region").ToString().Trim().ToUpper().Equals("AMER") AndAlso CurrentRow("BUSINESS UNIT").ToString().Trim().ToUpper().Equals("AMER Enterprise") AndAlso CurrentRow("Account Name").ToString().Trim().ToUpper().Equals(SPLIT_ACCOUNTNAME)

Cheers

ok let me try

1 Like

Hi @dutta.marina,
I had a look at your code. Like @Anil_G mentioned, changing the if condition per the attached screenshot should fix the issue for you.

I have tested it. Here is a sample workflow to help you with this.
Flowchart.xaml (11.2 KB)
Input.xlsx (8.7 KB)

The mistake here is enclosing the variable name inside double quotes. Anything between double quotes is treated as a string.

Regards,
Chetan