Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort Order Help
#1
Code:
Set oDesc=Description.Create() oDesc("micclass").value = "WebElement" oDesc("class").Value = "order_details_main_boxes" Set sLinks = Browser("Browser").Page("Page").ChildObjects(oDesc) sLinkCount = sLinks.Count PRINT sLinkCount For i = 0 to sLinkCount - 1 iName= sLinks(i).GetROProperty("innertext") iOrderNumber =Left(iName, 7) PRINT "Order Number " &iOrderNumber Next

Hi usng the above code i'm capturing order number details so when i run the script in my app i got the count value 2 ie.,

sLinkCount = 2
In the first loop i got Order Number = 5434565
In the second loop i got Order Number = 5434564

Now i want to check the sorting by taking these order numbers and wanted to store in array so that i want to check ascending/descending sorting...

Please help me out in this regard...
Reply
#2
Code:
arrCtry=Split(Browser("name:=QTP").Page("title:=QTP").WebList("name:=select1").GetROProperty("all items"),";") Set objArray=DotNetFactory.CreateInstance("System.Collections.ArrayList","") For i=0 to Ubound(arrCtry) If arrCtry(i)<>"--Choose One--" Then objArray.Add(arrCtry(i)) End If Next objArray.Sort() objArray.Insert 0,"--Choose One--" For j=0 to Ubound(arrCtry) strOuput=strOuput+objArray(j) strOuput=strOuput+";" Next If strOuput=Browser("name:=QTP").Page("title:=QTP").WebList("name:=select1").GetROProperty("all items")+";" Then Msgbox "The Weblist's values are sorted in alphabetical order" Else Msgbox "The Weblist's values are not sorted in alphabetical order" End If
Reply
#3
Hi vinod, actualy i don't want to use split funjction...i need order number to be stored in an array for every for loop iteration so that i can use them to check sort order..please help in sorting order number values into an arrray...
Reply
#4
Code:
Dim i, j, tmp Services.StartTransaction "BubbleSort" For i = ( UBound( arr ) - 1 ) to 0 Step -1 For j = 0 to i If arr( j ) > arr( j + 1 ) Then tmp = arr( j + 1 ) arr( j + 1 ) = arr( j ) arr( j ) = tmp End If Next Next Services.EndTransaction "BubbleSort" End Sub
Reply
#5
hi,

bubble sort method is not working for me...

order numbers i have stored in an array...
functionality is to check sort order when i click on order number column...so whenever i click on order number column it will change sort order from existing sort display....assume sort order is displaying in ascending order then if i click on order number column it will change to descending order...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Should I download every patch in order to UFT recognize the Chrome and FireFox browse jesusisaac 6 6,358 08-25-2016, 05:03 PM
Last Post: Ankesh
  Get numbers inside all webelements in webtable and sort them pradeep537 1 3,369 08-04-2016, 01:24 AM
Last Post: Ankur
  Automating SAP Sales Order Dwarak Calayampundi 0 2,036 06-09-2016, 09:28 AM
Last Post: Dwarak Calayampundi
  Sort multidimensional array SBsteven 8 10,304 03-14-2014, 02:49 PM
Last Post: anuj.bajaj
  sort two dimensional array. venkatesh9032 0 2,102 03-06-2014, 02:47 PM
Last Post: venkatesh9032

Forum Jump:


Users browsing this thread: 1 Guest(s)