SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    New Member
    Join Date
    Jul 2014
    Location
    Los Angeles, California, United States
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Question Exporting data sheets into excel

    Hello,
    I am trying to tweak this code to be able to export my Global sheet results on 2 columns in a single excel worksheet. Here's the exact scenario:
    I have one instance of QTP that runs the same tests on a legacy version of an application (called APP1) I am testing. We ALSO have the new version of this app (APP2) I run a QTP test on as well. What I would love to do is have APP1 export to an APP1 column in the Excel worksheet and when I run the other test on APP2, it then exports to the 2nd column next to APP1 results it in the same worksheet. The automation scripts aren't executed at the same time so no sharing violation issues with the Excel sheet.
    Here's the code i have so far.. any help would be appreciated.
    Fredrick

    Set oDesc = Description.Create()
    oDesc("html id").Value = "protocolNumber"
    oDesc("micclass").Value = "WebElement"
    Set oChild = Browser("Browser").Page("Page_8").ChildObjects(oDe sc)
    intTableCount = oChild.Count
    intCurTblRow = DataTable.LocalSheet.GetCurrentRow
    For intObj = 0 to intTableCount -1

    DataTable.LocalSheet.SetCurrentRow intObj +1
    DataTable("ProcNumCTOL2") = oChild(intObj).GetROProperty("innertext")

    Next
    'DataTable.ExportSheet "C:\Temp\Adv Search Results.xlsx", ProcNum
    'DataTable.Export "C:\Temp\Adv Search Results.xlsx"

    DataTable.Export "\\infoscidiv\users\fsookiasian\Temp\CTOL2 - Type of Study_B_1.xls"

  2. #2
    Member
    Join Date
    Mar 2008
    Posts
    66
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    If you need to execute the same script on different applications App1 and App2. Try to find a property value which could distinguish App1 and App2 e.g. could be something like version number could be anything.
    Assuming applications are distinguishable using version number then, when version number = x have your values populated in column1 and otherwise have your values populated in column2.
    Being said that, you can use below code to have your values populated in the external excel sheet -
    'Following would set column_num for each versioned Application i.e, App1 and App2 in your case
    If version_num = x Then
    Column_Num = 1
    Else
    Column_Num = 2
    End If

    'Your code goes here

    'Following piece of code should satisfy your need
    Set oExcel = CreateObject("Excel.Application")
    Set owb = oExcel.Workbooks.Open("Excel path")
    For rowNum = 1 to intTableCount - 1 'Check this once
    oExcel.Cells(rowNum,Column_Num).Value = oChild(intObj).GetROProperty("innertext")
    Next

    'Destroy object instances

    Let know if it solved your problem.

  3. #3
    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
    For your scenario you have to do coding like below

    If Excel.exist then (Check for the availability of the Excel, if so you have already executed the test already)
    Import the excel
    Check for the column number
    Write the test output in 2nd column
    Export the sheet
    Else
    Write the test output in 1st column
    Export the sheet
    End If

    you can modify your code based on above logic
    Venu
    Today is always better than Tomorrow
    My Blog
    My LinkedIn

 

 

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.71%
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 04:16 AM.

Copyright BetaSoft Inc.