Micro Focus QTP (UFT) Forums
problem with row selection in javatable - 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: problem with row selection in javatable (/Thread-problem-with-row-selection-in-javatable)



problem with row selection in javatable - samuel45 - 09-09-2010

--So I'm trying to select a certain row from a javatable.
My code is this--
Code:
Dim numrows
numrows = JavaWindow().JavaTable().JavaInternalFrame().GetROProperty("rows")
numrows = Cint(numrows)
Dim i
i = 0
Dim rowtoselect
rowtoselect = -1
While i<numrows AND rowtoselect = -1
    If Cint(JavaWindow().JavaInternalFrame().JavaTable().GetCellData(i,0)) = Cint(parameter("itemone")) Then
        rowtoselect = i
    End If
        i=i+1
Wend

JavaWindow().JavaInternalFrame().JavaTable().SelectRow rowtoselect

--each time I check with a messagebox and see that the variable "rowtoselect" gives me a integer, and it does me a correct integer, but when I use the command .SelectRow it only selects the first row of my javatable. Another weird thing is when I input some command such as SelectRow "#10" it selects row 10 with no problem, it just won't work when I use my variable as my row number. Can anyone offer any advice as to what may be wrong?--
--as a side note I also checked to see if the parameters were coming through from the previous steps and they were coming through fine--