Send mail if nested if loop doesn't match

Hi Everyone,

I have an excel with 3 columns and mail with a table with 3 columns
I extract table from mails and store it in an excel and then compare the extracted excel with main excel

I use if loop to match two excel using read range and then second if loop to match second column and then third loop to match third columns , if all three matched i update main excel and move the mail to some other folder ,

Now my issue is if the mail table data doesn’t match with any of the rows in the excel i need to send an exception mail to business , i.e., inside nested if loop , could u please help me on this @Palaniyappan @Gokul001

Thanks in advance

1 Like

Set a flag = false in the else condition and set flag = true in true condition and after the whole nested if loop check if the flag value is true or false? if flag value is false it means any one of the condition failed so then send a mail

We can do this with long query and based on the output we get from those expression we can send the exception as a mail

But as you are using if conditions here
We can get this done with few variable creations

In if activity you would have Mentioned the condition in a way to compare two values and if it matches then it goes to then block or else block

For now you would have added activities inside the then block as condition matches
But if the condition doesn’t match it will go to ELSE block where use a assign activity like this

bool_Nomatches_1 = True

Where bool_Nomatches_1 is a variable of type Boolean defined in the variable panel and this is used in if activity used for first column

You can use same kind of two more Boolean variables in next two IF activity used for second and third columns

Now once after all these Boolean variable creation use a if activity with condition set like this

bool_Nomatches_1 = False OR bool_Nomatches_2 = False OR bool_Nomatches_3 = False

If any of the above one is true it goes to THEN block where use a send mail activity and send he exception mail

Hope this would help you resolve this

Cheers @kavya.s16