05-12-2009, 08:18 AM
Hi guys,
I'm a relatively new to QTP and VBscript. I'm having problem with the following script:
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:
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.
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.