Micro Focus QTP (UFT) Forums

Full Version: GetCellData syntax
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I'm a relatively new to QTP and VBscript. I'm having problem with the following script:


Code:
Dim myarray()
arrayLength = JavaWindow("M1").JavaInternalFrame("Inventory").JavaTable("Inventory").GetROProperty("rows")
Redim myarray(arrayLength)

For i = 1 to arrayLength
    myarray(i) = JavaWindow("M1").JavaInternalFrame("Inventory").JavaTable("Inventory").GetCellData(i, "Name")
Next

I'll get the following error when executed:

The statement contains one or more invalid function arguments.

Line (15): "myarray(i) = JavaWindow("M1").JavaInternalFrame("Inventory").JavaTable("Inventory").GetCellData(i, "Name")".


But if I were to set the variable value for "i" manually like so:

Code:
myarray(0) = JavaWindow("M1").JavaInternalFrame("Inventory").JavaTable("Inventory").GetCellData(0, "Name")
myarray(1) = JavaWindow("M1").JavaInternalFrame("Inventory").JavaTable("Inventory").GetCellData(1, "Name")
myarray(2) = JavaWindow("M1").JavaInternalFrame("Inventory").JavaTable("Inventory").GetCellData(2, "Name")

I'll be able to store the value in myarray.

What's wrong with using "i" as parameter argument for GetCellData?

Am I doing something wrong? Please advise.

Thanks.
Hi, The Syntax of GetCellData is

Code:
var_GetCellData = swfWindow("myWindow").swfTable("myTable").GetCellData(Row, Column)