Micro Focus QTP (UFT) Forums
How to choose a random no from list - 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: How to choose a random no from list (/Thread-How-to-choose-a-random-no-from-list)



How to choose a random no from list - alwarselvam - 12-24-2011

Code:
Window("Flight Reservation").ActiveX("MaskEdBox").Type DataTable("DepartureDate", dtGlobalSheet)
Window("Flight Reservation").WinComboBox("Fly From:").Select cint( DataTable("Flyfrom", dtGlobalSheet))
Window("Flight Reservation").WinComboBox("Fly To:").Select cint (DataTable("Flyto", dtGlobalSheet))
Window("Flight Reservation").WinButton("FLIGHT").Click
Dim n
n=Window("Flight Reservation").Dialog("Flights Table").WinList("From").Getitemscount
Window("Flight Reservation").Dialog("Flights Table").select RandomNumber(1,n)
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").click
Window("Flight Reservation").WinEdit("Name:").Set DataTable("TicketHolder", dtGlobalSheet)
Window("Flight Reservation").WinEdit("Tickets:").Set DataTable("No_of_Tickets", dtGlobalSheet)
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").WinButton("Update Order").Click
Window("Flight Reservation").Close

the above script is not executing.can anyone tell me whats wrong in that.