Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data Table iteration question
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Nice to meet you all. I am new to QTP and I have a question and detail as:

I am using QTP 11 with powerbuilder add-in

Here is my case
I have 10 lines of code.
I have 30 rows in Data Table
I want to iterate line 3-7 30 times using Data Table as parameter
Line 1-2,8-10 execute one time only.

My problem is when I execute my qtp script, its iterate 30 times for line 1-10.

Please advise. Thank you.
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

Set the test settings as "Run One Iteration Only"
Goto - > Test Settings ->RUN--> Select "Run One Iteration Only"

Here is the code,


Code:
' Line 1 to line 2 of your code

For i = 1 to DataTable.GetSheet("dtGlobalSheet").GetRowCount
    DataTable.SetCurrentRow(i)
'    Line 3 to Line 7 of your code

   Next

   ' Line 8 to line 10 of your code

The above code should work.. If you still have issues please paste the code that you are using

- Vinod
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Thank you KVK. It works.
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Hello,

I am a new User in QTP, I have a question.
Following is my Code.


Code:
1.    Browser("Xtra login page").Page("XTRA login page").WebEdit("userName").Set "Alex"
2.    Browser("Xtra login page").Page("XTRA login page").WebEdit("userName").Submit
3.    Browser("XTRA login page").Page("XTRA login page").Link("Manage Customer").Click
4.    Browser("XTRA login page").Page("XTRA").WebButton("Create New").Click
5.    Browser("XTRA login page").Page("XTRA").WebEdit("customerid").Set DataTable("CustomerID", dtGlobalSheet)
6.    Browser("XTRA login page").Page("XTRA").WebEdit("name").Set DataTable("UserName", dtGlobalSheet)
7.    Browser("XTRA login page").Page("XTRA").WebEdit("telephone").Set DataTable("TelePhone", dtGlobalSheet)
8.    Browser("XTRA login page").Page("XTRA").WebEdit("email").Set DataTable("Email", dtGlobalSheet)
9.    Browser("XTRA login page").Page("XTRA").WebEdit("address1").Set DataTable("Address", dtGlobalSheet)
10.    Browser("XTRA login page").Page("XTRA").WebEdit("zipCode").Set DataTable("ZipCode", dtGlobalSheet)
11.    Browser("XTRA login page").Page("XTRA").WebEdit("city").Set DataTable("City", dtGlobalSheet)
12.    Browser("XTRA login page").Page("XTRA").WebList("countryCode").Select DataTable("Country", dtGlobalSheet)
13.    Browser("XTRA login page").Page("XTRA").WebButton("Save & Close").Click

In this scenario I want to run line 1 and 2 only once and rest of the lines according to the Data Table data.
Kindly let me know Rolleyes
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
use the below code:

Code:
Browser("Xtra login page").Page("XTRA login page").WebEdit("userName").Set "Alex"
Browser("Xtra fake login page").Page("XTRA login page").WebEdit("userName").Submit
iRows=DataTable.getrowcount
For i=1 to iRows
   DataTable.SetCurrentRow(iRow)
  Browser("XTRA login page").Page("XTRA login page").Link("Manage Customer").Click
Browser("XTRA login page").Page("XTRA").WebButton("Create New").Click
Browser("XTRA login page").Page("XTRA").WebEdit("customerid").Set DataTable("CustomerID", dtGlobalSheet)
Browser("XTRA login page").Page("XTRA").WebEdit("name").Set DataTable("UserName", dtGlobalSheet)
Browser("XTRA login page").Page("XTRA").WebEdit("telephone").Set DataTable("TelePhone", dtGlobalSheet)
Browser("XTRA login page").Page("XTRA").WebEdit("email").Set DataTable("Email", dtGlobalSheet)
Browser("XTRA login page").Page("XTRA").WebEdit("address1").Set DataTable("Address", dtGlobalSheet)
Browser("XTRA login page").Page("XTRA").WebEdit("zipCode").Set DataTable("ZipCode", dtGlobalSheet)
Browser("XTRA login page").Page("XTRA").WebEdit("city").Set DataTable("City", dtGlobalSheet)
Browser("XTRA login page").Page("XTRA").WebList("countryCode").Select DataTable("Country", dtGlobalSheet)
Browser("XTRA fake login page").Page("XTRA").WebButton("Save & Close").Click
Next
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
Thank you Smile Its working fine.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Object not found during the 2nd iteration of an Action call in a For loop BGunay 0 969 04-23-2020, 07:08 PM
Last Post: BGunay
  UFT Tool runs more than one iteration always cthossain 2 3,724 02-12-2017, 01:25 PM
Last Post: cthossain
  data table use uft_usr 1 2,235 06-29-2016, 05:23 PM
Last Post: Ankesh
  Writing to Run time data table Neetha 5 12,163 08-27-2015, 10:18 AM
Last Post: supputuri
  Function return value is not passed during the 3rd iteration premanand1979 0 2,254 10-16-2014, 09:40 PM
Last Post: premanand1979

Forum Jump:


Users browsing this thread: 1 Guest(s)