Micro Focus QTP (UFT) Forums
Getcelldata and Setcelldata - 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 and Setcelldata (/Thread-Getcelldata-and-Setcelldata)



Getcelldata and Setcelldata - rajeshdizzy - 07-16-2009

Hi.....all
How to retrieve the values by using the Getcelldata and setcelldata.is it only applicable for Web based application .Then how to use this.I tried with yahoo.
Is tis one correct and what is the actuall use of doing this...

Code:
Dim i,j
For i=1 to Row count
For j=1 to column count

msgbox browser("Yahoo! Mail: The best").Page("Yahoo! Mail: The best").WebTable("Yahoo! ID:").GetCellData (i,j)

Next
Next

Pls anyone answer me.............


RE: Getcelldata and Setcelldata - balakrish - 07-16-2009

Hi all,
**********getting the rowcount**********
Code:
var=SAPGuiSession("Session").SAPGuiWindow("Create Sales Order: Initial").SAPGuiTable("Distribution Channel").rowcount
msgbox var
*********Getting the cell data for the particular row and column*********
Code:
SAPGuiSession("Session").SAPGuiWindow("Create Sales Order: Initial").SAPGuiTable("Distribution Channel").getcelldata(1,"Material")
1 is row number
Material is columnname of the GuiTable



RE: Getcelldata and Setcelldata - supputuri - 07-16-2009

Hi rajeshdizzy ,
i think you know the use with getcell data and setcelldata.

You can use the following code. For better understanding purpose please use one column and get all data from all the rows based on the column and then move to another column.
'One more thing is we should specify the row number while getting the column count.
'--------------------------------------------------------------------------------------
Code:
For i= 1 to Browser("SAM").Page("SAM").WebTable("Database:").ColumnCount(1)
    For j = 1 to Browser("SAM").Page("SAM").WebTable("Database:").RowCount
        Msgbox "Data from Column # " & i & ",Row # " & j &" is ''"& Browser("SAM").Page("SAM").WebTable("Database:").GetCellData(j,i) & "''."
    Next
Next
'--------------------------------------------------------------------------------------
Let me know if you need any more info.


RE: Getcelldata and Setcelldata - rajeshdizzy - 07-17-2009

Hi...King....
i cannot understand anything.....explain with an example of any website like yahoo or gmail.............and want 2 know wat is the use of doin this and wat to check?


RE: Getcelldata and Setcelldata - balakrish - 07-17-2009

Hi dizzy,

see the example below,

for getting the rowcount for the webtable,SAPGuiTable etc., ,use rowcount method.

Code:
var=SAPGuiSession("Session").SAPGuiWindow("Create Sales Order: Initial").SAPGuiTable("Sales Order").rowcount

msgbox var
here getting how many rows present in the GuiTable

for i=1 to var

var1=SAPGuiSession("Session").SAPGuiWindow("Create Sales Order: Initial").SAPGuiTable("Sales Order").GetCellData(i,"Material")

msgbox var1

next

here we can get the cell data upto the loop will exit.

for set the cell data in the SAPGuiTable

Code:
SAPGuiSession("Session").SAPGuiWindow("Create Sales Order: Initial").SAPGuiTable("Sales Order").SetCellData 1,"Material","100"

1 is row name
"Material" is column
"100" is data

here i have explained for SAP application ,this script same for web application also.