Micro Focus QTP (UFT) Forums
Retrieving data from a webtable and Saving data to a DataTable - 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: Retrieving data from a webtable and Saving data to a DataTable (/Thread-Retrieving-data-from-a-webtable-and-Saving-data-to-a-DataTable)



Retrieving data from a webtable and Saving data to a DataTable - Brian T. - 07-15-2010

I currently have code to retrieve specific data from a webtable...I now want to take the data I retrieved and save to a datatable ....

Code:
Dim objTable, ADid
objTable = Browser("").Page("").WebTable("").GetCellData(4, 1)

ADid = mid(objTable,  instr (objTable, "ADID=")+5,7)
When I message box it returns the data I'm looking for.

Thanks,
Brian


RE: Retrieving data from a webtable and Saving data to a DataTable - sreekanth chilam - 07-15-2010

Hi Brian,

Refer the below example and implement accordingly.

Code:
ADid = mid(objTable, instr (objTable, "ADID=")+5,7)
DataTable.Value("Test_Col",dtLocalSheet)= ADid  
Msgbox DataTable("Test_Col",dtLocalSheet)

You can find this value in RunTime DataTable in Test Results Window.


RE: Retrieving data from a webtable and Saving data to a DataTable - Brian T. - 07-15-2010

Thanks,

For the reply....I ran the code but I do not see where it updated the datatable cell with the data retrieved from the web Table. The msgbox displays the correct data, but I would think that the below code would retrieve the data from the webtable and then place that data in the local datatable in cell row 19 column AD_ID.

Code:
Dim objTable, ADid
objTable = Browser("").Page("").WebTable("").GetCellData(4, 1)
ADid = mid(objTable, instr (objTable, "ADID=")+5,7)
DataTable.SetCurrentRow (19)
DataTable.Value("AD_ID",dtLocalSheet)= ADid  
Msgbox DataTable("AD_ID",dtLocalSheet)
bRIAN


RE: Retrieving data from a webtable and Saving data to a DataTable - sreekanth chilam - 07-15-2010

Hi Brian,

Fyi, DataTable.SetCurrentRow(RowNumber) Sets the specified row as the current (active) row in the GlobalSheet of run-time DataTable .

In case of Localsheet then it should be in the below way:
Code:
Datatable.GetSheet("LocalSheetName").SetCurrentRow(RowNumber)



RE: Retrieving data from a webtable and Saving data to a DataTable - Brian T. - 07-16-2010

Thanks,

I tried but the data is still not showing up in specified cell location of the data table. should it be displayed?

I need the data to be added to the data table so I can access that data for future test.

Brian


RE: Retrieving data from a webtable and Saving data to a DataTable - sasmitakumari - 07-16-2010

Hi Brian,
While runing the script the runtime data will be there in the DataTable till you end the excution, and when you stop the run, there wont be any data.
You can do one thing Export the data table after you finish saving the datatable.

Ex:
DataTable.Export("C:\ExpTest.xls")