SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Nov 2007
    Location
    Preston, UK
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    QTP Newbie Needs Datatable Help

    Hi
    I am fairly new to QTP, but have read up, and have a reasonable understanding of datatables and their subtypes (global and local). My problem is this:

    I have for example three scripts A, B & C.
    All three scripts call script D (via RunAction).
    I want to have a separate sheet in the datatable of each of scripts A, B & C that can pass data to script D when it is called. Script D is parameterized to accept values from a datatable.
    However if within script D, I reference the local sheet the values are stored only in the datatable for script D and are read-only in scripts A,B & C.
    If if I use the global sheet the values are stored in the global sheet in the datatable for script D and are appended to the next available columns in the datatables within scripts A,B & C. At least with this method they are editable.
    However this is an untidy approach, and I would much prefer a separate editable sheet for each called script within the datatable of the calling parent script. Is this possible?
    The only partial solution I can think of is to specify a load statement at the top of script D instructing it which datatable to load. But I am unsure how I would implement this or pass the correct path to load each time it is called.
    Any help you guys can give is much appreciated. Sorry if this post is a little lengthy.

  2. #2
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: QTP Newbie Needs Datatable Help

    Have you thought of using an Excel Workbook with 4 Worksheets present?

    There is lots of Excel COM code on this site which can be executed from QTP.

    Try searching for Excel COM here and on Microsoft Here:

    http://www.microsoft.com/technet/scr...s/archive.mspx

    Here's some code to get you started:

    '================================================= ========================
    Function getxlrecordset(xl_file_name,xl_sheetname)
    xl_file_name=trim(xl_file_name)
    xl_sheetname=trim(xl_sheetname)
    strConnDest="DRIVER={Microsoft Excel Driver (*.xls)};DBQ="&xl_file_name&";"
    set oConnDest =createobject("adodb.connection")
    oConnDest.Open strConnDest
    Set rsXL=oConnDest.Execute("SELECT * FROM ["&xl_sheetname&"$]")
    Set getXLRecordset = rsXL
    End function



    xl_file_name="D:\data\test1.xls"
    xl_sheetname="XXXXX"
    set rs=getxlrecordset(xl_file_name,xl_sheetname)
    While not (rs.EOF)
    msgbox rs("SQL_Query") ' These are the column names which
    msgbox rs("screen_name") ' must be in row 1 of the worksheet
    rs.movenext
    wend

    ' format of sheet used in above example is:


    'Row1 SQL_Query screen_name

    'Row2 Query1 Logon

    'Row3 Query2 Enquiry

    'Message boxes will not display SQL_Query & screen_name
    'as these are treated as column names
    '================================================= ===================

    Mark Smith.

 

 

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 12.50%
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 01:59 PM.

Copyright BetaSoft Inc.