Micro Focus QTP (UFT) Forums
if...then syntax frustration - 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: if...then syntax frustration (/Thread-if-then-syntax-frustration)



if...then syntax frustration - mrmarkus48 - 04-07-2009

I'm using 9.5 on a pretty standard web application.
For some reason the following code is not working...

Code:
If (Browser("MyApp").Page("MyApp").Check CheckPoint("MyApp"))  Then
    Reporter.ReportEvent micPass, "Page_Load", "Success!"
End If


I get two syntax errors:

1) expected ")" [between the Check and the Checkpoint]
2) Expected end of statement

Please help!Sad


RE: if...then syntax frustration - Tarik Sheth - 04-07-2009

I guess you missed one '(' , it should be


Code:
If (Browser("MyApp").Page("MyApp").Check (CheckPoint("MyApp"))



RE: if...then syntax frustration - Rachna - 04-07-2009

you have missed '('
Code:
If (Browser("MyApp").Page("MyApp").Check CheckPoint("MyApp")))  Then
    Reporter.ReportEvent micPass, "Page_Load", "Success!"
End If

hope this would work fine for you!


RE: if...then syntax frustration - Tarik Sheth - 04-07-2009

Hello,
Rachna in your solution I am getting following error.

'(' expected.

As I mentioned above you can use following code.

Code:
If Browser("MyApp").Page("MyApp").Check (CheckPoint("MyApp")) Then
Reporter.ReportEvent micPass, "Page_Load", "Success!"
End If



RE: if...then syntax frustration - mrmarkus48 - 04-07-2009

Thank you SO much. I can't tell you how long I stared at that code. if it had been Visual Test, I would have nailed it right away. Smile