SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    262
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Add rows from different applications to DataTable

    I have a question regarding the DataTable. I have multiple applications which each one consists of number of rows. I need to extract the values of the rows of each application and add it to the dataTable. I am able to add the rows of the first application, but when QTP opens the second application to add the rows value, it overwrites the values from the first application.

    I tried to use DataTable.GetRowCount to get last row in the dataTable and then use DataTable.SetNextRow, but it is not working. Here is a scenario:
    Application A has 10 Rows and Application B has 30 rows; how to add all of these rows in the DataTable

  2. #2
    Advanced Member
    Join Date
    May 2006
    Location
    United Kingdom
    Posts
    742
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    SetNextRow spec says that If the current row is the last row in the data table, applying this method sets the first row in the data table as the new current row. Is this situation?

  3. #3
    Member
    Join Date
    Sep 2009
    Posts
    262
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Maybe the way I did it is not correct. If you understand my scenario, please provide me with a good way to approach this issue

  4. #4
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,596
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Perhaps use .SetCurrentRow(x)
    You can use .GetRowCount()
    Then add +1 and use it in .SetCurrentRow().

    I think that SetCurrentRow() allows you to move to it as long as it is not more than one row number above the current row count.

  5. #5
    Advanced Member venu.adhikesevan's Avatar
    Join Date
    Jun 2010
    Posts
    517
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Get row count from application 'A' and do fetch the details, once it's done get row count from application 'B' and add the row count to application 'A' row count as below
    Use SetCurrentRow() function for row pointer

    rowcount = getrowcount('A')
    rowcount = rowcount + getrowcount('B')
    Venu
    Today is always better than Tomorrow
    My Blog
    My LinkedIn

  6. #6
    Member
    Join Date
    May 2011
    Location
    California, US
    Posts
    306
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    I would perhaps use a similar way what bklabel1 has suggested.
    GetRowCount and set the current row to the +1 row

  7. #7
    Advanced Member
    Join Date
    May 2007
    Posts
    609
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    It doesn't look like adding rows to the DataTable dynamically is allowed. From the QTP help for DataTable.SetCurrentRow:
    Code:
    Important Information  
    
    You can set a row only if it contains at least one value.
    So you cannot set it to the last+1 row.

    I would recommend writing the values you need to Excel, using the automation object, or maybe a csv file. If you cannot find good information on how to do that, I can provide some examples.
    Dennis Belew

  8. #8
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,596
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    Dennis,

    In previous versions of QTP, I could create a row of data. It could only add a row if it is after the highest row number of data. For example: There is data on rows 1,2,3,4. I could add data to row 5 but not 6.

    I have not tried in QTP 11 or UFT.

    Thanks,

    Kevin

  9. #9
    SQA Knight bklabel1's Avatar
    Join Date
    Sep 2012
    Location
    Kew Gardens, United States
    Posts
    2,596
    Post Thanks / Like
    Blog Entries
    1
    Mentioned
    2 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    I put a break point on the x= 1 line.

    It allow me to put values into any place on the data sheet.

    Code:
    DataTable("Kevin",dtGlobalSheet) = "Row 1"
    DataTable.SetCurrentRow(2)
    DataTable("Kevin",dtGlobalSheet) = "Row 2"
    DataTable.SetCurrentRow(5)
    DataTable("Kevin",dtGlobalSheet) = "Row 5"
    x = 1

  10. #10
    Advanced Member
    Join Date
    May 2007
    Posts
    609
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    you mean the help file lied!? inconceivable!
    Dennis Belew

 

 
Page 1 of 3 123 LastLast

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 9.38%
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 09:59 AM.

Copyright BetaSoft Inc.