Micro Focus QTP (UFT) Forums
webtable object help - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: webtable object help (/Thread-webtable-object-help)



webtable object help - swetha.b - 12-28-2009

Hi All,

I have a problem getting the row count from a grid which may have few records.
My purpose is to check whether the grid has records if yes then random set any record and click ok. But when there is no record available in the grid then click on the cancel button of the grid window.
Here is the code I have written:

Code:
unitowner = mypage.WebTable("UnitOwnerGP").RowCount
'Fetches the row count

Webtable gives a wrong count - which gives total row count not the existng record count???

'msgbox unitowner

Code:
Set objChildItem2 = mypage.WebTable("UnitOwner").ChildItem(RandomNumber(2, unitowner -1),2,"WebElement",0)
objChildItem2.click

'used this object to click the element
now question is how do I get the value of an element. Is my below code valid?

Code:
If  objChildItem2.value= true Then
mypage.Image("OwnerOK").Click

else
mypage.Image("CancelOwner").Click
end if