I use the following functions to pull information from winlists.  I
often need to find a particular value and then additional information
in that row.  I place rows into an array element and separated by two
colons.  I then split the element into another array and search to my
heart's content.

Function winListViewColumnCount(windw)
   winListViewColumnCount = windw.ColumnCount
End Function

Function winListViewRowCount(windw)
   winListViewRowCount = windw.GetItemsCount
End Function

' a function to return each row of WinListView object
' will handle 2 to 5 columns
Function valueArray(windw)
   Dim numRows, numCols, i, id, col2, col3, col4, col5, valArray()
   numCols = WinListViewColumnCount(windw)
   numRows = WinListViewRowCount(windw)
   msgbox("number of rows = " & numRows)
   ReDim valArray(numRows - 1)
   If numCols = 2 Then
           For i = 0 to numRows - 1
                   id = windw.GetSubItem(i)
                   col2 = windw.GetSubItem(i,1)
                   valArray(i) = id & "::" & col2
           Next
        elseif numCols = 3 Then
                For i = 0 to numRows - 1
                        id = windw.GetSubItem(i)
                        col2 = windw.GetSubItem(i,1)
                        col3 = windw.GetSubItem(i,2)
                        valArray(i) = id & "::" & col2 & "::" & col3
                Next
        ElseIf numCols = 4 then
                For i = 0 to numRows - 1
                        id = windw.GetSubItem(i)
                        col2 = windw.GetSubItem(i,1)
                        col3 = windw.GetSubItem(i,2)
                        col4 = windw.GetSubItem(i,3)
                        valArray(i) = id & "::" & col2 & "::" & col3 & "::" & 
col4
                Next
        ElseIf numCols = 5 then
                For i = 0 to numRows - 1
                        id = windw.GetSubItem(i)
                        col2 = windw.GetSubItem(i,1)
                        col3 = windw.GetSubItem(i,2)
                        col4 = windw.GetSubItem(i,3)
                        col5 = windw.GetSubItem(i,4)
                        valArray(i) = id & "::" & col2 & "::" & col3 & "::" & 
col4 & "::" &
col5
                Next
   End If
   valueArray = valArray
End Function

Function winListGetColumnHeader(windw)
   Dim numCols, i, valArray, val
   numCols = windw.ColumnCount
   ReDim valArray(numCols - 1)
   For i = 0 to numCols -1
                val = windw.getColumnHeader(i)
                valArray(i) = windw.GetColumnHeader(i)
   Next
                winListGetColumnHeader = valArray
End Function

windw is from using Set for example:
Set wndow = Window("name").Dialog("name2").WinListView("name3")

Hope this helps.


On Jun 6, 10:07 pm, s sankar <[email protected]> wrote:
> Hi,
>
> In the sample application shipped with QTP , how to select flight number
> alone from the winList.
> eg :Window("Flight Reservation").Dialog("Flights
> Table").WinList("From").Activate "15802   DEN   10:24 AM   FRA   01:54 PM
> AF     $173.47"
>  i need to get 15802 alone.
>
> Thanks
> sankar

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to