Results 1 to 2 of 2
  1. #1

    Switching columns during a test

    I am trying to accomplish the following:

    I want to capture data from a web table and put that value in the datatable.

    The web table has 30 columns and 40 rows.

    I have a dual for loop set up...the outer loop iterates through columns, the inner loop iterates through the rows.

    I have the column names stored in an array, each time all of the rows of a column have been filled, the column name switches to the next column.

    My problem is....quicktest will not move to the next column....it simply stays in one column for the entire test, overwriting one column over and over.

    I will post the set up below:

    Dim NumArray
    NumArray = Array("columnName1", "columnName2"..."etc")

    For j = 0 To 29 'column
    For i = 0 To 39 'row

    value = "Grabs the value from web table position i,j"
    'This adds the value to the datatable
    Datatable.Value(NumArray(j),dtLocalSheet) = value




    Why won't QTP switch columns??
    Any help will be greatly appreciated.


  2. #2

    Re: Switching columns during a test

    You have to set up another array with with the name of the DataSheet PROPERTY(column) you want to store the value in. Try something like this...

    Dim ColumnName(5) (stores 6 values)

    For i = 0 to 5
    For j = 0 to 5

    value = "GET THE VALUE HERE"
    DataTable(ColumnName(j),dtLocalSheet).Value = value


    DataTable.LocalSheet.SetCurrentRow i

    You should check the DATATABLE stuff out first, since I am not exactly sure on the syntax (don't have my book with me...) but you can tell the datasheet which column you want to store stuff in. Just make that second array and use it.

    Hope that helps...



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 05:33 PM.

Copyright BetaSoft Inc.