Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get value of a List view item
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
How to get a value from a List view.

For me x = SwfWindow("Connected to 157.235.206.175").SwfListView("inventoryList").GetVisibleText is showing the entire value in the listview.
My List view has 10 columns and 5 rows.

I need the value of the third column in second row.
How I can get it.
Please help me.
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
The Below program might solve your problem
a brief explanation of the below program

1) get total no of columns --------->(ColumnCount)
2) get total no rows in the wilnlist view------->(GetItemsCount)
3) retrieve the desired value from the column------>(GetSubItem(i,C_Name))


Code:
With Dialog("Text:=Windows Task Manager")
    .wintab("nativeclass:=SysTabControl32").Select "Processes"
    
R_Count=.WinListView("nativeclass:=SysListView32").GetItemsCount
'msgbox ("Total no of rows"&R_Count)

C_Count=.WinListView("nativeclass:=SysListView32").ColumnCount
'msgbox ("Total no of columns:  "&C_Count)

For i=0 to R_Count-1
    For j=0 to C_Count-1
        C_Name=.WinListView("nativeclass:=SysListView32").GetColumnHeader(j)
        t= .WinListView("nativeclass:=SysListView32").GetSubItem(i,C_Name)
        
    Next
Next
End With

i hope the above program will help you
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanks sree.....
Everything works for me except two line
1)stView_ChildObjects")=t
2)Endwith

Can I store the values of C_name and t in a two diamensional array in QTP?
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
the above two lines are not required for u. you can comment those lines...

"C_name" it the name of the coloumn and t is the values in the column like
C_name
--------
aaaa
bbbb
cccc

so you can't take the data into a two dimensional array
but u can load the data into a data table or to an excel sheet
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Sree,

Thanks a lot for this post.

Regards,
Deepak
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot identify the specified item Beginner 0 2,481 06-22-2017, 04:55 PM
Last Post: Beginner
  SwfTree View Validation in UFT YogeshCallappa 0 2,131 10-28-2016, 01:26 PM
Last Post: YogeshCallappa
  WinListView set item command Shahino007 0 2,643 10-06-2015, 03:57 PM
Last Post: Shahino007
  Objects are being recognized as "Windows for Menu item list (Browser-firefox, UFT 12) akhandesh 0 2,527 05-27-2015, 06:29 PM
Last Post: akhandesh
Question Outside View Terminal Emulator testing joncfrazier 0 3,377 12-04-2013, 10:47 PM
Last Post: joncfrazier

Forum Jump:


Users browsing this thread: 1 Guest(s)