Micro Focus QTP (UFT) Forums
Get numbers inside all webelements in webtable and sort them - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Get numbers inside all webelements in webtable and sort them (/Thread-Get-numbers-inside-all-webelements-in-webtable-and-sort-them)



Get numbers inside all webelements in webtable and sort them - pradeep537 - 08-03-2016

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



RE: Get numbers inside all webelements in webtable and sort them - Ankur - 08-04-2016

Sorting can be done in number of ways. There are several such questions discussed earlier. Please try a search at the top right.