Micro Focus QTP (UFT) Forums

Full Version: How to choose a random no from list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.