SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    May 2002
    Posts
    116
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Data Tables Help

    I am trying to create a data sheet within an action. I want the sheet to be specific to that action.

    When I try to use the data driver it keeps trying to put my data into the global sheet.

    I went ahead and manually entered my data into the local sheet but QTP keeps erroring out because it says the sheet does not exist when I try to call for the value from the script.

    Is there something I am missing about creating a data sheet within an action?

    Scenario: I have my global sheet set up with data for 25 states (State name, address etc.)The script will run multiple iterations using this data to go from state to state. I have created an action which can add additional drivers if needed, I have my logic in the action set up so that depending on a flag it either will or will not add additional drivers, if it does add more it will loop through and keep adding drivers.

    Now not all states will need to have more than one or any states for that mantter which is why I have the flag set up. It works fine using the recorded data but I wanted to add different driver information for each new driver if added.

    What I want to do is as it runs through each state if that state is set for additional drivers I want it to add them from the list in the action (that is why I don't want it in the global sheet)

    I hope this makes sense if anyone has a suggestion I would appreciate it.

    Thanks

  2. #2
    Member
    Join Date
    Nov 2004
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Data Tables Help

    I'm a bit confused. You start off talking about the Data Driver, then later you make reference to adding drivers, but I assume you are not talking about the same thing?

    Is the problem you are having just a matter of identifying each sheet properly?

    If you don't specify a SheetID in your datatable statement, it will always look for the value in the global sheet.

    Example:
    x = datatable("Flag")

    If you do specify the sheet you have more control:
    x = datatable("Flag", dtLocalSheet)
    or
    x = datatable("Flag", "SheetName")

    But it gets trickier if the statement references a datasheet specific to a different test, such as when one test (i.e. "TestMain") calls another test (i.e. "AddStates"):

    x = datatable("Flag", "SheetName [TestMain]")

    Once you have the correct syntax to identify datasheets located in different actions, you should be able to check a flag in one datasheet (even if it's a different action in a different test script) and based on that flag then loop through whatever you need while accessing data in a totally different datasheet/action/script.

    Does that address the issue you were having?

    Blake

  3. #3
    Senior Member
    Join Date
    May 2002
    Posts
    116
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Data Tables Help

    Sorry about the confusion. When I was talking about drivers later on I meant automobile drivers, they are part of the application.

    I seem to be having an issue getting the test to find the data sheet I want it to use.

    This is all within one action in one test so I am not trying to call anything from another test or script.

    I have a data sheet called Additional_Driver with a column named DTDriver_dtAdditional_Driver so in my script when I try to access the data in the column I use this:

    Select DataTable("DTDriver_dtAdditional_Driver", Additional_DriverSheet)

    but I keep getting the sheet does not exist. I'm sure it is something silly but I just can't seem to figure out what it is. I am fairly new to QTP but this shouldn't be a major issue I would think.

    Thanks for the help.

  4. #4
    Senior Member
    Join Date
    May 2002
    Posts
    116
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Data Tables Help

    Ok I figure out what the problem was I needed to change the setting for the data table tio use local sheet instead of global - duh.

    Now I have a new problem it is going to the sheet just fine now but my rows are not getting set correctly. This is what I have :

    DataTable.GetSheet("Driver_dtAdditional_Driver").S etNextRow

    but it keeps saying that it cannot find the sheet now, any suggestions?

  5. #5
    Member
    Join Date
    Nov 2004
    Posts
    85
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Data Tables Help

    The datatable functions as follows. The datatable has a row pointer. Initially, the pointer is set to row 1. Each iteration through the test updates the datatable to set its pointer to a new row (assuming the "run on all rows" setting). When a parameter is needed, the parameter name is the column name in the datatable. If your column has more than one row of values, the parameter will be selected based on which row the pointer is currently pointed to.

    You can monkey around with the row pointer by SetRow, SetPrevRow, and SetNextRow methods, but this pointer is independent of columns because it points to an entire row for the whole datatable. Note that this can play havoc with the "run on all rows" setting.

    So, you set the row based on the sheet name, not the column name.

    DataTable.GetSheet("Additional_Driver").SetNextRow

    Should be what you're looking for. If you are setting rows dynamically in your script, you might want to make sure you chose "run one iteration only" instead of "run on all rows" - and then take complete control of the row pointer throughout your whole script.

    Blake

 

 

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 11.54%
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 10:07 PM.

Copyright BetaSoft Inc.