Search This Blog

Monday, August 9, 2010

Getting the data from a WinList View Object

The below code explains how we can extract the data from a WinListView object and store that data in the run time DataTable and also export it to the required location in the end.

Col_count = Window(" ").WinlistView(" ").ColumnCount
Row_count = Window(" ").WinlistView(" ").GetROProperty("items count")

For i = 0 to Col_count
Col_Header = Window(" ").WinlistView(" ").GetColumnHeader(i)
DataTable.GetSheet(1).AddParameter(Col_Header, "") ' This is to add the column header to the datatable
Next


For i = 0 to Row_count
DataTable.SetCurrentRow(i+1)

For j = 0 to Col_count
Header = Window(" ").WinlistView(" ").GetColumnHeader(j)
Row_Item = Window(" ").WinlistView(" ").GetItem(i)
Var = Window(" ").WinlistView(" ").GetSubItem (Row_Item, Header)
DataTable(Header, GlobalDt)= Var
Next
Next

DataTable.Export "C:\QTP Automation\WinlistView_Data.xls"

No comments:

Post a Comment