Micro Focus QTP (UFT) Forums
QTP DataTable.Import Issue - 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: QTP DataTable.Import Issue (/Thread-QTP-DataTable-Import-Issue)



QTP DataTable.Import Issue - Neha Singh - 09-13-2010

Hi,

I am trying to import data from xls file using DataTable.Import statement.

But while running it is executing for first row only.
eg: if my xls contains 4 rows then it will run 4 times for first row only.

Settings:
In run settings I have selected "Run for all rows" then also same pronlem

And I have tried below mentioned code also but I can not use that becuase I am using Recovery Scenario, in which I am closing all browser & giving "Proceed to next iteration"
rowcount = Datatable.Getrowcount
For i = 1 to rowcount
Datatable.SetCurrentrow(i)
****Code*****
Next


Thanks & Regards,
Neha Singh


RE: QTP DataTable.Import Issue - Prafulla - 09-13-2010

If you have imported the sheet as local sheet check your Action call properties.


RE: QTP DataTable.Import Issue - Neha Singh - 09-13-2010

Hi Prafulla,

Thanks for the reply.
I am importing in Global sheet only.

Thanks & Regards,
Neha Singh


RE: QTP DataTable.Import Issue - Prafulla - 09-13-2010

Please upload the code


RE: QTP DataTable.Import Issue - jsknight1969 - 09-13-2010

I had the same issue. Never could figure it out. What I found was that it would only run the same number of rows you had in the design environment data tab. If I had 3 row there regardless of how many I imported, it would only run 3 rows.

I ended up doing the following.
Code:
Dim x, rowcount
    rowcount = DataTable.GetSheet("Sheet1").GetRowCount
    'set row and get data
    For x = 1 to rowcount
            DataTable.SetCurrentRow(x)
        'do your processing here

    Next



RE: QTP DataTable.Import Issue - uma87 - 08-26-2011

hey did u find the solution for the above issue you dicussed, I'm facing the same problem. Can you help me out please.
I Have 4 rows,when i Used datatable.import, then it will run 4 times for first row only
I tried
Code:
rowcount = Datatable.Getrowcount
For i = 1 to rowcount
Datatable.SetCurrentrow(i)
"test script"
Next
it is running on four rows but the for loop is exceuted for four times.


RE: QTP DataTable.Import Issue - parminderdhiman84 - 08-26-2011

Hi,

Go to File>>Settings>>Run and select Run one Iteration Only

Regards,
Parminder