Micro Focus QTP (UFT) Forums
AND operator issue - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: AND operator issue (/Thread-AND-operator-issue)



AND operator issue - mv8167 - 09-09-2011

I have the code:

Code:
If blFlagA1=True AND blFlagA2=True AND blFlagA3=True AND blFlagA4=True Then

even though all four objects indacte True in my Variables list durring debugging, the If statement does not execute.

Does anyone have an idea on why?

thx guys

Lorena


RE: AND operator issue - Ankesh - 09-12-2011

it might be that the values in the variable is String. Here u r comparing with a boolean value.

try the below code

Code:
if blFlag="True" AND blFlagA2="True" AND blFlagA3="True" Then

I hope this would work.

Regards,
Ankesh
It might be that the values in the variables are string values and u r comparing for the boolean value.

Try the below code...
Code:
If blFlagA1="True" AND blFlagA2="True" AND blFlagA3="True" AND blFlagA4="True" Then


i hope this would work.

Regards,
Ankesh


RE: AND operator issue - mv8167 - 09-12-2011

Ankesh,

Your the best. That was it. I guess I was mind numb last week as it never entered my mind to use double quotes. I just figurerd it was the variable within the OR. I guess I could have used 1 imnstead. But using double quotes worked as I wanted.

Thx ;-)


RE: AND operator issue - vIns - 09-13-2011

Hi Lorena...good to know it is working fine as expected for you..

in such cases, do NOT check if it is true. just give the stmt as given below to avoid such syntax/run time error...

If blFlagA1 AND blFlagA2 AND blFlagA3 AND blFlagA4 Then


RE: AND operator issue - mv8167 - 09-14-2011

vIns,

Thx! I tried this earlier but QTP just didn't like the coding structure for whatever reason. I hope to try this again once I get my co0mplete code successfully coded and running.

thx for reading and giving a pointer. ;-)