Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get numbers inside all webelements in webtable and sort them
#1
Solved: 8 Years, 3 Months, 3 Weeks ago
Hello guys,

I have attended QTP interview @broadridge hyd he asked me this question

webtable was there 3 rows 3 columns inside webtable all are webelemnts and 9 numbers(3,1,9,4,7,2,6,5,8) were there inside these webelements.we have to retrieve all these 9 numbers and sort them.

I have written this below code please check once and let me now anything wrong and if any better solutions for this.

set wb=browser().page().webtable()
rc=wb.rowcounnt
For i = 1 To rc
    cc=wb.columncount(i)
    For j = 1 To cc 
        txt=wb.childitem(i,j,"Webelement",0).getroproperty("innertext")
        a=a&txt&";"
    Next
Next
b=split(a,";")
For i=0  To ubound(b)
For j=0 To ubound(b) 
    If strcomp(b(i),b(j),1) < 0 Then
        temp = b(i)
         b(i)=b(j)
         b(j)=temp
    End If
Next
Next
For i=0 To ubound(b)
    msgbox b(i)
Next
Reply
#2
Solved: 8 Years, 3 Months, 3 Weeks ago
Sorting can be done in number of ways. There are several such questions discussed earlier. Please try a search at the top right.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Set Value in JavaEdit Inside JavaTable yonobev 9 12,980 11-08-2017, 11:12 PM
Last Post: lotos
  Objects inside WpfList shinji458 23 22,289 11-08-2017, 10:54 PM
Last Post: lotos
  Not able to click text inside the grid dropdown szkapoo 6 4,636 12-20-2014, 09:43 PM
Last Post: supputuri
  Comparing webtable data with weblist and webelements in other webpage arnav 1 5,812 04-18-2014, 10:01 PM
Last Post: Parke
  Sort multidimensional array SBsteven 8 9,037 03-14-2014, 02:49 PM
Last Post: anuj.bajaj

Forum Jump:


Users browsing this thread: 1 Guest(s)