Not able to use if else for one of condition

I have an request where i need to check following condition
If Coloumn A,B,C,D = X or Y and Des = J then coloumn O/P = 1
If coloumn A,B,C,D = M,N,O,P,Q,R then M= open google, N = open yahoo , O= open uipath P= open cnbc Q= open gmail R= open amazon .
Any help will be appreaciated special for MNOPQR condition as row can have one fix value , more than one or null.

create a string variable for each column you need in your conditions and Assign their values like this:
str_A = Convert.ToString(row(0))
str_B = Convert.ToString(row(1))

IF str_A=“X” AND str_B=“X”…

this way you dont have to worry much about errors when things are null…

If its X or Y in either case no only X in some case you will have A,C = X or Y and in some case you will have ABCD = X or Y

my point is just using the convert.tostring so it is easier on the conditions…

I already did and A, C = X or Y works but bit stucked on A,B, C, D = X or Y condition

As what to do with other MNOPQR values

the way you are writing your condition is hard to tell what you need…
IF ((strA=X AND strB=X AND strC=X AND strD=X) OR (strA=Y AND strB=Y AND strC=Y AND strD=Y))

if Coloumn A = M then open google , if it has M,N then open google and open yahoo.
if it has MNOPQR then open google,yahhoo,uipath,gmail and amazon.com as well one thing is MNOPQR can splited with comma(ie ‘,’) but there is no order that M will be first position or N will on first position in cell

IF (strA.contains(“M”) AND strA.contains(“N”) AND strA.contains(“O”)…)

Let me try this @bcorrea what if it has M,N, O all three of them. will it works?

you have to know what you need there… i understand you need to check if it has ALL MNO… but you can use OR instead if that is what you need…

What if we use switch case instead of if/else

can be tidier but inside you will need the conditions anyway…

Hey @apurvalost,

The way I would go about opening the websites based on the letters in the cell:
OpenWebsites.zip (2.8 KB)

Hope that I understood the requirements right. :slight_smile:

I would first create a simple CSV config file, in the idea of mapping each letter with its corresponding link from the start. Easily updatable should anything change.

Thanks Man Appreciated @alin.c.mihalea and @bcorrea

Happy to help. Happy automating!

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