Micro Focus QTP (UFT) Forums
GetCellData syntax - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: GetCellData syntax (/Thread-GetCellData-syntax)



GetCellData syntax - jason77 - 05-12-2009

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.


RE: GetCellData syntax - manojith1984 - 05-12-2009

Hi, The Syntax of GetCellData is

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