Micro Focus QTP (UFT) Forums
import form excel file - 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: import form excel file (/Thread-import-form-excel-file)



import form excel file - sekhan - 10-10-2010

i used a file excel to import into datatable. The column name in the excel file matched the parameter name in my test, and the sheet in the excel file matched the action name in my test too. In the excel file, i have two data row. but when i run my test, i just get the result for the first data row.
can you explain for me Sad


RE: import form excel file - venkatbatchu - 10-10-2010

Hi Sekhan,

When you import the data from external source i.e Excel sheet always first row data will treat as parameters in data table.

Ex: If you have 2 rcords in excel then first record data is the parameter name in the data table.


Please let me know for futher clarification.



Regards,
Venkat. Batchu


RE: import form excel file - A.Saini - 10-10-2010

Hi Sekhan,

Select "Run For All Rows" from "test settings-> Run".

Hope it wil work...
Smile


RE: import form excel file - sekhan - 10-11-2010

hi saini
my test is always selected "run on all rows" but it does not work exactly too

hi venkatbatchu
i am using qtp9.2 and ie7
in my excel file, first row is "user" --> param name in datatable
second row is first record
third row is second record.
and when i run the test, it run the first record in 2 interations without running the second record


RE: import form excel file - A.Saini - 10-11-2010

Hi sekhan,

I need few more details about your test:

1) Are you entering the data in global data sheet?

2) If no, are you using some external action and talking about action sheet?

Smile


RE: import form excel file - sekhan - 10-11-2010

no, global sheet in datatable is null, all records are stored in excel file
this is all of scripts in my project:
Code:
Datatable.Import("D:\Software Quality Control\pncbookstore\Login.xls")

Browser("Browser").Page("Online").Link("Login").Click
Browser("Browser").Page("Login_Online").WebEdit("user_login").Set DataTable("user", dtGlobalSheet)
Browser("Browser").Page("Login_Online").WebEdit("user_login").SetTOProperty "value", DataTable("user", dtGlobalSheet)
strMail = Browser("Browser").Page("Login_Online").WebEdit("user_login").GetTOProperty("value")
Browser("Browser").Page("Login_Online").WebEdit("password").SetSecure "3c32f2445bbc7481db3492b1d1556ceb7fdf9e03ca7be253143d"
If strMail = "d_quangvu@yahoo.com" Then
    Browser("Browser").Page("Login_Online").WebButton("Login").Click
    Browser("Browser").Page("Online").Link("Logout").Click
else
    reporter.ReportEvent micFail, "Failed Report","..."
End If
Browser("Browser").Close



RE: import form excel file - sekhan - 10-20-2010

i have the script

Code:
datatable.import("...")
For i = 1 to Datatable.GetRowCount
DataTable.SetCurrentRow(i)
datatable.GetCurrentRow
...
datatable.setnextrow
next

my datatable have 2 record (imported from excel file). i see when i run my action, it will run 2 iterations, and in a iteration it run 2 record too. i want my action just run 1 record for 1 iteration. how must i do? Sad
help me please