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
Hi Friends, Can any one answer this question? 17) What method is used to retrieve the number of columns in the query results? A. Fields.Count B. Fields.Item(EOF) C. Fields.Count(BOF) D. Fields.Count.Value
I AM TRYING PORT CODE FROM WINRUNNER TO QTP AND DON'T KNOW TO HOW TO CHECK THE ERRORS. IN WINRUNNER FUNCTION RETURNS EIGHER 0 OR -1 AGAINST WHICH RESULT CAN BE MADE PASS OR FAIL BUT IN QTP I DON'T SEE FUNCTIONS RETURNING ANY VALUE. APPRECIATE IF ANYONE COULD HELP ME CONVERTING FOLLWOING WINRUNNER CODE TO QTP. set_window("Customer Service"); rc = web_obj_get_text("Summary","#2","#4",ssn,""," ",1); if (rc != E_OK) { report_msg("[GetSubscriberSummary] Could Not get subscriber SSN; rc = "&rc); myRC = rc; } else { ssn = StripBlank(ssn); if (DEBUG) report_msg ("[GetSubscriberSummary] SSN: "&ssn); }
Synchronization methods?
Kindly help me with the following queries.. -- How to recognize webtable using QTP and how to use it? -- How would one conclude that it is a web table -- For Example, if there is a web table and I am clicking on say Cell A1, how would i know that i've clicked on cell A1 -- Kindly suggest me to use the web table better
How many types of Automation frameworks are there in UFT? Describe them.
Hello friends can anybody tell me about the architecture of QTP with diagram of it.this architecture is same for any domain like ERP/Banking/CRM/Healthcare or it's different then please tell me.thanks
What do you do if QTP doesn't recognize object ,what action should be taken
WHAT IS THE DESCRIPTIVE programming when it is useful? & when to use this ?
What is recovery scenario manager? When you go for recovery scenario manager? Tell me one scenario were your used recovery scenario in your project?
Hello, I am facing problem to check textpoint for mercury application . I have inserted checkpoint to check flight summary for place of departure and arrival with datatable and script look like "Browser("Find a Flight: Mercury").Page("Book a Flight: Mercury").Check CheckPoint("Book a Flight: Mercury_4")" but while I am executing this script at last my check point gets fail and display Text Checkpoint: captured "" between Summary and 4/31/2008FLIGHT , expected "Acapulco" Match case: ON Exact match: OFF Ignore spaces: ON I think value from data table is not fatched so please guide me what I have to do to overcome this problem.. Thanks
What is difference between shared and local object repository?
After coming to know that QTP could not identify non-standard objects, we set those non-standard objects as virtual objects using Virtual object wizard. But how can we identify that qtp could not identify non-standard objects?