Micro Focus QTP (UFT) Forums
Exporting drop down values in Excel - 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: Exporting drop down values in Excel (/Thread-Exporting-drop-down-values-in-Excel)



Exporting drop down values in Excel - sudhirzpatil - 10-27-2010

Hi All,
I am trying to export run time drop down values to excel. I am able to export but not as expected.
In flight reservation We have Fly From and Fly TO drop down,
When we select particular City from Fly From, same City should not display in Fly TO.
I want the result in excel as
from to
Denver Frankfurt
Denver London
Denver Los Angeles
Denver Paris
Denver Portland
Denver San Francisco
Denver Seattle
Denver Sydney
Denver Zurich
Zurich Denver
Zurich Frankfurt
Zurich London
Zurich Los Angeles

so on....

but i am getting values as

from to
Denver Frankfurt
London
Los Angeles
Paris
Portland
San Francisco
Seattle
Sydney
Zurich
Zurich Denver
Will any one help on this ?


RE: Exporting drop down values in Excel - supputuri - 10-28-2010

Make sure that you are passing the two parameters every time.


RE: Exporting drop down values in Excel - sudhirzpatil - 10-30-2010

I am trying with following scripts, but still not get expected result.

Code:
dim i,f,x
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set "derfs"
Dialog("Login").WinEdit("Password:").SetSecure "4cc3c6e3f379b4bebf919e0c56d8d4ad4172027c"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "111910"
f=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
datatable.AddSheet("output").AddParameter "from", ""
datatable.AddSheet("output").AddParameter"to",""
For i=0 to f-1 step 1
x=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)
DataTable.Value("from","output") = x
t=Window("Flight Reservation").WinComboBox("Fly To:").GetItemsCount
For j=0 to t-1 step 1
t=Window("Flight Reservation").WinComboBox("Fly To:").GetItem(j)
DataTable.Value("to","output") = t
DataTable.SetCurrentRow(j+1)
If x <>t Then
Reporter.ReportEvent 0,"Res","Test Passed"
Else
Reporter.ReportEvent 1,"Res","Test Failed"
End If
Next
next
DataTable.ExportSheet "G:\QTP Result\Exported files\Get values form both drop down.xls","output"



RE: Exporting drop down values in Excel - KavitaPriyaCR - 11-02-2010

Hi
Change the code inside the j loop as:
Code:
t=Window("Flight Reservation").WinComboBox("Fly To:").GetItem(j)
DataTable.Value("to","output") = t
DataTable.SetCurrentRow(j+1)
If x <>t Then
Reporter.ReportEvent 0,"Res","Test Passed"
Else
Reporter.ReportEvent 1,"Res","Test Failed"
End If
DataTable.Value("from","output") = x
Next



RE: Exporting drop down values in Excel - Saket - 11-03-2010

@Everyone - Please wrap your code in the tags to make it readable, refer posting guidelines.