08-03-2016, 12:38 AM
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
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