Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie: How do i count through a webtable to find an entry?
#1
Solved: 10 Years, 8 Months ago
I need to find an entry in a web table but I am new to QTP and not sure how to do this. I have done the following:


Code:
Dim test1
Dim RCount
Dim CCount
Dim  fail

fail = "FAIL"
RCount = 1
CCount = 0
For RCount = 1 to RCount =  16
    For CCount = 0 to 16
test1 = Browser("Test").Page("TEST PAGE").Frame("mainFrame").WebTable("OrderTable").getcelldata(Rcount,CCount)  
If test1 = " 10337893" Then
msgbox test1
End If
CCount = Ccount +1
If test1 <>   "10337893" Then
msgbox fail
RCount = RCount +1
End If
next
next

But I really not sure how to do this, I am complete newbie to vbscripting too.
Reply
#2
Solved: 10 Years, 8 Months ago
Hi,

Try with RowCount,ColumnCount methods of WebTable and loop thru the WebTable.

Note: Once your expected entry is found, quit out of the loop using "Exit For" statement.

Hope you could solve it on your own Smile
Reply
#3
Solved: 10 Years, 8 Months ago
Hi,

If you want to check the existance of the specific data in the webtable you can use the "GetRowWithCellText" method which will retrive the row number where the data is displayed.

Code:
For intSearchColumn= 1 to Browser().Page().Frame().WebTable().ColumnCount(1)
  IntRowNum = Browser().Page().Frame().WebTable().GetRowWithCellText("10337893",intSearchColumn)
  If IntRowNum > 1 Then
   msgbox "Data found in Column : " & intSearchColumn & " Row : " & IntRowNum
   Exit For
  End If
Next

Please let me know if you need any more information.
Thanks,
SUpputuri
Reply
#4
Solved: 10 Years, 8 Months ago
Thanks to the both of you. I managed to figure it out but doing a slightly different way.

I have another question about function libraries files to create my own library but will post another thread.

Thanks!
Reply
#5
Solved: 10 Years, 8 Months ago
Hi -

I see the VBScript but not QTP. How does QTP use this code? Is it called from a QTP script? Is this code actually in QTP? Sorry but don't see how this code works with QTP.

Thanks
Reply
#6
Solved: 10 Years, 8 Months ago
HI SRA,

we have to place this code in QTP and then execute ..... :-)
Thanks,
SUpputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Excelsheet data entry Anshu 0 1,480 07-11-2017, 07:41 PM
Last Post: Anshu
  Entry Certification diya 3 2,577 12-04-2012, 05:42 AM
Last Post: diya
  WebTable..Row and Column Count Brian T. 10 71,945 03-16-2012, 04:45 PM
Last Post: Teju
Toungue How to figure out how to use my count to correctly find the requiered link mv8167 2 2,617 08-24-2011, 09:39 PM
Last Post: mv8167
  Getting WebTable Count akapoor 3 4,634 03-21-2011, 11:33 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)