Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieving data from a webtable and Saving data to a DataTable
#1
Solved: 11 Years, 4 Months ago
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
Reply
#2
Solved: 11 Years, 4 Months ago
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.
Reply
#3
Solved: 11 Years, 4 Months ago
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
Reply
#4
Solved: 11 Years, 4 Months ago
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)
Reply
#5
Solved: 11 Years, 4 Months ago
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
Reply
#6
Solved: 11 Years, 4 Months ago
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")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiple rows of test data Bhuvana 0 1,341 01-03-2020, 09:30 PM
Last Post: Bhuvana
  Set data parameters Mik2s 1 1,491 03-07-2019, 10:18 PM
Last Post: supputuri
  Excelsheet data entry Anshu 0 1,621 07-11-2017, 07:41 PM
Last Post: Anshu
  Want to read the data from excel and set read value in the JavaTable rajeevk7 0 2,317 07-10-2017, 04:20 PM
Last Post: rajeevk7
  dtLocalSheet empty even though excel file contains data cantorre 2 2,434 05-10-2017, 12:47 PM
Last Post: vidhi

Forum Jump:


Users browsing this thread: 2 Guest(s)