How do you script a nested loop in QTP?
I am showing a snipet of my code. Any suggestions to help
me get this to work would be great appreciated!
STEP A
- Customer Number: No loop
- ISBN: Loop
STEP B
- Customer Number: Loop
- ISBN: Nested Loop
Here is the code I am using now. I am using i for the loop
and j for the nested loop in STEP B of my script.
===========================================
'CREATE AN ADDITIONAL CUSTOMER
Dim myNum, RowNum, RowCnt2, val2, total, i
DataTable.ImportSheet "C:\QOE Data -
UAT1.xls" ,"Data" ,"Global"
RowCnt2 = DataTable.GetRowCount
i = 1
DataTable.SetCurrentRow(i) ' Set row to one
Do while Not i > RowCnt2
i=i+1
DataTable.SetNextRow
MsgBox Datatable.Value("Customer_Num")
Msgbox i
Msgbox RowCnt2
If Not i > RowCnt2 then
val2=datatable.Value("Customer_Num","Global")
OracleFormWindow("Sales Order").SelectMenu "File->New"
OracleFormWindow("Sales Order").OracleTabbedRegion("Order
Information").OracleTextField("Customer Number").SetFocus
OracleFormWindow("Sales Order").OracleTabbedRegion("Order
Information").OracleTextField("Customer Number").Enter val2
End If
'CREATE SECOND ISBN LIST
DataTable.ImportSheet "C:\QOE Data -
UAT1.xls" ,"Data" ,"Global"
Dim j, RowCnt3, val3
RowCnt3 = DataTable.GetRowCount
For j = 1 To RowCnt3
DataTable.SetCurrentRow(i)
' datatable.getSheet("DataTable").setNextRow
If Trim(DataTable("ISBN",dtGlobalSheet)) = "" Then
j = j - 1
Exit For
End If
Next
'Define ISBN rows
If RowCnt3 <> j Then
RowCnt3 = j
End If
'Loop through ISBN rows
For j = 1 To RowCnt3
DataTable.SetCurrentRow(i)
val3 = Datatable.Value("ISBN","Global")
msgbox j
If j = 1 Then
OracleFormWindow("Sales Order").OracleTabbedRegion("Line
Items").OracleTextField("Ordered Item").SetFocus
OracleFormWindow("Sales Order").OracleTabbedRegion("Line
Items").OracleTextField("Ordered Item").Enter val3
else If j < 16 Then
OracleFormWindow("Sales Order").OracleTabbedRegion("Line
Items").OracleTextField("Ordered Item_"&i).SetFocus
OracleFormWindow("Sales Order").OracleTabbedRegion("Line
Items").OracleTextField("Ordered Item_"&i).Enter val3
else If RowCnt1 => 16 Then
OracleFormWindow("Sales Order").OracleTabbedRegion("Line
Items").OracleTextField("Ordered Item_15").SetFocus
OracleFormWindow("Sales Order").OracleTabbedRegion("Line
Items").OracleTextField("Ordered
Item_15").InvokeSoftkey "DOWN"
OracleFormWindow("Sales Order").OracleTabbedRegion("Line
Items").OracleTextField("Ordered Item_15").SetFocus
OracleFormWindow("Sales Order").OracleTabbedRegion("Line
Items").OracleTextField("Ordered Item_15").Enter val3
end if
end if
End If
Next
'EXIT APP
msgbox i
loop
Browser("Browser").Page("Oracle Applications 11i").Sync
Browser("Browser").Close
==========================================
It isn't working correctly in my nested loop in STEP B (for
ISBN).
Any ideas??
Thanks!
SBsteve
No Answer is Posted For this Question
Be the First to Post Answer
i m tryed to use qtp in a user registration form but at the "image enter"part it gives a error when i run the qtp bcz the image is changed every time so it gives a error when i use regukar expreesion fot this it still gives a error value bcoz it reads the image code bt nt reconige the image which i enter in the image verification text box.so hw can i automate qtp for this function.plz give me a answer
In your QTP framework, what checkpoints were applied in the script to minimize script failure due to any reason during execution?
Up to how much VB scripting knowledge and what type of VB script knowledge is required for a QTP test engineer for real time to work ?
IF we use batch testing.the result shown for last action only.in that how can i get result for every action.
hi to all, i need a code.. in flight application 1.i need to login first then i need to insert 3 new orders... 2.i have to log out 3.i have to login again with different user 4.need to insert 2 new orders 5.then need to log out 6.then again login with different user 7.3 new orders create and log out 8.but we hv to do this using data table and actions please help me
Is it possible to run QTP scripts created in IE 6.0 in IE 7.0?
To which environments does quicktest professional (qtp) supports?
Explain runtime dynamic settings?
what to do if application have 3 "ok" button with same logical name and same properties, how qtp can identify them.
can we run the scripts of qtp 8.2 in the qtp7.0?
HoW to open QTP in Real time.after getting the qtp window how to log in .pl answer real time people
if numbers are always changing write a script for that