SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Apr 2008
    Posts
    65
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    running multiple rows of data

    I am trying to run multiple lines of data in my datatable. I have the following:

    RunAction "1" Oneiteration
    RunAction "2" Oneiteration
    RunAction "3" Oneiteration

    Datatable.getsheet("1").SetNextRow
    Datatable.getsheet("2").SetNextRow
    Datatable.getsheet("3").SetNextRow

    What do I need to wrap around this to loop it?

  2. #2
    Member
    Join Date
    May 2007
    Location
    Dublin, OH USA
    Posts
    467
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: running multiple rows of data

    Here is what I used. Read my commented out areas to see what my code is actually doing. Just modifiy this to meet your needs. Hope it helps!

    *****************************************

    DataTable.ImportSheet "<Location of Excel>\QTP Scripts\Scripts - QUAL\QOE_QUAL\Excel\QOE Data - QUAL.xls" ,"Data" ,"Global"
    Dim RowCnt1, val1
    RowCnt1 = DataTable.GetRowCount
    For i = 1 To RowCnt1
    DataTable.SetCurrentRow(i)
    'ISBN is the column header name
    If Trim(DataTable("ISBN",dtGlobalSheet)) = "" Then
    i = i - 1
    Exit For
    End If

    'Define ISBN rows
    If RowCnt1 <> i Then
    RowCnt1 = i
    End If
    Next

    'Loop through ISBN rows
    For i = 1 To RowCnt1

    DataTable.SetCurrentRow(i)
    val1 = Datatable.Value("ISBN","Global")
    If i = 1 Then
    OracleFormWindow("Sales Order").OracleTabbedRegion("Main").OracleTextField ("Ordered Item").SetFocus
    OracleFormWindow("Sales Order").OracleTabbedRegion("Main").OracleTextField ("Ordered Item").Enter val1
    OracleFormWindow("Sales Order").OracleTabbedRegion("Main").OracleTextField ("Qty").Enter "2"

    else If i =< 3 Then
    OracleFormWindow("Sales Order").OracleTabbedRegion("Main").OracleTextField ("Ordered Item_"&i).SetFocus
    OracleFormWindow("Sales Order").OracleTabbedRegion("Main").OracleTextField ("Ordered Item_"&i).Enter val1
    OracleFormWindow("Sales Order").OracleTabbedRegion("Main").OracleTextField ("Qty_"&i).Enter "3"

    End if
    End If
    Next
    ************************************************** ***

    SBsteve

  3. #3
    Member
    Join Date
    Apr 2008
    Posts
    65
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: running multiple rows of data

    The problem I am running into is that my test is not moving onto the next row of data. After my first row of data is complete I do my set next row lines but when my test runs again it is still using my data from the first row.

    Any thoughts?

  4. #4
    Member
    Join Date
    May 2007
    Location
    Dublin, OH USA
    Posts
    467
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: running multiple rows of data

    What do you mean by "when my test runs again"?

    Do you mean multiple iterations or a loop running within one script or do you mean running the script multiple times?

    Have you searched this forum for keyword "first row"?

    SBsteve

  5. #5
    Member
    Join Date
    May 2007
    Location
    Dublin, OH USA
    Posts
    467
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: running multiple rows of data

    Are you using my code and tweaking it for your use?

    If so, please post here what you have so far.

    SBsteve

  6. #6
    Member
    Join Date
    May 2008
    Location
    NJ, USA
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: running multiple rows of data

    my scenario was same to run on multiple rows in data table
    here is my code which will run as many as rows are filled in data table

    ptLName = DataTable("PtLName", <font color="red"> 1 </font> ) ''probably, sheet nuber makes difference.

    If ptLName &lt;&gt; "" Then
    '' Call your function or do something
    Else
    ExitTest
    End If
    --
    Thanks,

    Srini

  7. #7
    Member
    Join Date
    Apr 2008
    Posts
    65
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: running multiple rows of data

    Are you using multple sheets in your data table?

  8. #8
    Member
    Join Date
    May 2008
    Location
    Beaver Dam, WI USA
    Posts
    72
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: running multiple rows of data

    The way we are running this type of loop is with a do while loop.
    <font class="small">Code:</font><hr /><pre>
    ....

    currRow = 1

    DataTable.GetSheet("xyz").SetCurrentRow(currRow)

    Do while DataTable.GetSheet("xyz").GetParameter("abc").Valu e &lt;&gt; ""

    ....

    currRow = currRow + 1

    DataTable.GetSheet("xyz").SetCurrentRow(currRow)


    loop
    </pre><hr />

    That is the basics of my looping scheme. It starts a counter to tell the data table what row to be on and then loops through each row setting the current row each time around until the cell is blank. if you need to run it on certain rows you can use a for loop via.

    <font class="small">Code:</font><hr /><pre>
    for int i = x to y

    DataTable.GetSheet("xyz").SetCurrentRow(i)
    ...

    next

    </pre><hr />

    you could fill in numbers for x and y to be the start and end rows. When you set the current row of data that is when it knows what row to get the data from. I'm sure you can implement this in your script for the entire test. Good luck let us know what way works.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:34 AM.

Copyright BetaSoft Inc.