10-19-2010, 12:27 PM
Hi,
In my application we are having values as links in grids with pagination based on the records in the DB.
I need to find a value in the grid and click to do actions.The value that i want to search may be in the first page or in any where in the pages of the application.
1.Values for search wil be given in the QTP datatable.
2. i am getting the total no.of pages, starting from the first page i am getting the total records inside the page ( Grid).
3. then i am comparing the search value with the grid value if matches then run some statements and then it should exit from both loops and start from first line of code for the second given value.
The following is my code:
But the above code is not working as excepted.
Exit For for the inner loop is working but the outer loop is not working.
can anybody help me.
In my application we are having values as links in grids with pagination based on the records in the DB.
I need to find a value in the grid and click to do actions.The value that i want to search may be in the first page or in any where in the pages of the application.
1.Values for search wil be given in the QTP datatable.
2. i am getting the total no.of pages, starting from the first page i am getting the total records inside the page ( Grid).
3. then i am comparing the search value with the grid value if matches then run some statements and then it should exit from both loops and start from first line of code for the second given value.
The following is my code:
Code:
row = DataTable.GetSheet("Global").GetCurrentRow
Browserpage.Link("name:=1").Click ' Clicks the first page
EmailId = DataTable.GetSheet("Global").GetParameter("EmailId").ValueByRow(row)
Pages = 3 ' getting during the run time
For i = 1 to pages
count = 5 ' getting during the run time
For j = 2 to count
Tablelink = gridlist(3).GetCellData(j,1) ' getting during the run time
If Trim(EmailId) = Trim(Tablelink) Then
EmailID.Click
Update.Click
Exit For ' the control should exit from the inner loop
Exit For ' the control should exit from the Outer loop and goes to the first line of code.
End If
Next
Browserpage.Link("name:=Next").Click ' Clicks the next page.
Next
But the above code is not working as excepted.
Exit For for the inner loop is working but the outer loop is not working.
can anybody help me.