Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Repeating If loop
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
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:

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
Reply


Messages In This Thread
Repeating If loop - by mv8167 - 06-30-2011, 11:06 PM
RE: Repeating If loop - by parminderdhiman84 - 06-30-2011, 11:17 PM
RE: Repeating If loop - by mv8167 - 06-30-2011, 11:34 PM
RE: Repeating If loop - by parminderdhiman84 - 06-30-2011, 11:45 PM
RE: Repeating If loop - by mv8167 - 07-01-2011, 06:59 PM
RE: Repeating If loop - by rajpes - 07-04-2011, 05:27 PM
RE: Repeating If loop - by mv8167 - 07-06-2011, 12:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  FOR LOOP shayk1985 1 5,301 12-13-2012, 11:35 AM
Last Post: sams001
  How to exit from a for loop silpavinod 2 9,873 10-17-2012, 12:55 AM
Last Post: agarwl.anurag
  for loop sia sharma 1 3,340 09-13-2012, 11:44 AM
Last Post: ksrikanth2k9
  Help with Loop LJENNE 1 3,187 08-10-2012, 12:32 PM
Last Post: Ankesh
  How to get out of infinite FOR loop... sssidana 3 4,560 07-20-2012, 01:04 AM
Last Post: sree.85

Forum Jump:


Users browsing this thread: 2 Guest(s)