06-30-2011, 11:06 PM
The loop below checks a date range, if no data is returned, a new date is used. If the 1st date fails, I check another date.
How can I better check if no data is found without using an If statement within an If statement?
Do loop?
My code:
How can I better check if no data is found without using an If statement within an If statement?
Do loop?
My code:
Code:
If Browser("Wisdom").Page("Wisdom IA").Frame("parent").WebElement("No Results Found").Exist(5) Then
'No data found for ACCT1 in ENV
Reporter.ReportEvent micFail,"No Data found for Row: " & DataTable.GlobalSheet.GetCurrentRow, " The Account Number: " & Datatable("ACCT1", dtGlobalSheet) & " in the ENV: " & Datatable("ENV", dtGlobalSheet) & " - has no Data."
'Try secondary End Date (eDate2)
Browser("Wisdom").Page("Wisdom IA").Frame("parent").Image("button_newsearch").Click
Browser("Fax Request").Page("Preferences").WebEdit("EndDate").Set eDate2 '= "03/25/2011"
Browser("Fax Request").Page("Preferences").WebElement("SearchPrefPage").Click
If Browser("Wisdom").Page("Wisdom IA").Frame("parent").WebElement("No Results Found").Exist(5) Then
Reporter.ReportEvent micFail,"No Data found for Row: " & DataTable.GlobalSheet.GetCurrentRow, " The Account Number: " & Datatable("ACCT1", dtGlobalSheet) & " in the ENV: " & Datatable("ENV", dtGlobalSheet) & " - has no Data."
ExitTest
Else
'data found for ACCT1 in ENV
Reporter.ReportEvent micPass, "Data found for Row: " & DataTable.GlobalSheet.GetCurrentRow, " The Account Number: " & Datatable("ACCT1", dtGlobalSheet) & " in the ENV: " & Datatable("ENV", dtGlobalSheet) & " - has Data."
End If
Else
'data found for ACCT1 in ENV
Reporter.ReportEvent micPass, "Data found for Row: " & DataTable.GlobalSheet.GetCurrentRow, " The Account Number: " & Datatable("ACCT1", dtGlobalSheet) & " in the ENV: " & Datatable("ENV", dtGlobalSheet) & " - has Data."
End If