Reputation: 493
I created a fairly simple function, but I must have overlooked something because I get 3 errors on saving:
Here is the code:
Function ReportCheck(sParent, sReport, sTitle)
oParentWindow = "My_Reports," & sParent
BuildAndRunObject "My_Reports" , sReport,"LINK", "CLICK","","", "ABORT","","","",""
BuildAndRunObject oParentWindow ,sTitle,"WEBELEMENT", "EXIST","","", "","","","",""
'BuildAndRunObject oParentWindow ,"select","WEBELEMENT", "SELECT","2009 - 2013","SELECT_VALUE", "ABORT","","","",""
BuildAndRunObject oParentWindow ,"Create","WEBBUTTON", "CLICK","","", "ABORT","","","",""
Wait(20)
If BuildAndReportObject(oParentWindow, "Checkmark", "WEBELEMENT","VERIFY PROPERTY VALUE".TRUE. "VISIBLE","","","","","") and BuildAndReportObject(oParentWindow, "Report_Ready", "WEBELEMENT","VERIFY PROPERTY VALUE". TRUE. "VISIBLE","","","","","") Then
Reporter.ReportEvent micPass, "Credit Summary", "Report Generated Successfully"
Else
Reporter.ReportEvent micFail, sTitle, "Report Failed to Generate"
End if
End Function
The first error is for the IF line. The second error is for the Else. And the last is for the End If line.
What did I miss? I appreciate the second look. I am the only one at my company that uses VB Script so I don't have anyone to take a look...
Thanks,
Jamie
Upvotes: 0
Views: 1767
Reputation: 493
While I am not sure exactly what the issue was...
I retyped the above code in. I think QTP did not like something in my copy/paste and maybe there was a space or character I could not see that caused an issue. When I retyped the code - same as it appears above - then deleted the previous code, it passed a syntax check. More importantly - it ran without issue.
So, when in doubt, retype code line by line checking syntax as you go. Lesson learned.
Thanks to all that took the time to read and to KekuSemau for responding!
Jamie
Upvotes: 0
Reputation: 6856
It seems you try to concatenate strings with the .
- that is valid in PHP e.g., VBS uses &
(take care that spaces are required around the &
).
Upvotes: 2