Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP/UFT - Storing Multiple Arrays In An Array
#1
Not Solved
Also posted on stackoverflow with same subject line.

I have a function that imports a sheet to the global sheet and then loops through the columns and rows to create an array.

Code

Code:
    Public Function importArray()
   
    DataTable.ImportSheet "location","Lists", "Global"
   
    rowCount = DataTable.GetSheet(dtGlobalSheet).GetRowCount -1
    columnCount = DataTable.GetSheet(dtGlobalSheet).GetParameterCount
   
    ReDim myArray(-1)  
   
    For x = 1 to columnCount Step 1
   
    For i = 0 to rowCount Step 1
      
    ReDim Preserve myArray(UBound(myArray) + 1)
    myArray(i) = Datatable.Value(x, dtGlobalSheet)
    Datatable.SetNextRow
      
    Next
   
    MsgBox Join(myArray, vbNewLine)
   
    Next
   
    End Function


So now that I know I can get the columns into an array, I need to store each array individually.

For example:

Main array = myArray(i)

Call importArray() to get array

Column count = 2

Column names = Name, Surname

Store array into array variable with name as column name

Populate myArray() with stored arrays

myArray(Name(), Surname())

The reason I want to do this is because I have a function that will need to reference these arrays to look for a value in the array then do some logic. While I know that I can just create arrays one by one, the problem is that I might have 20 arrays to use, in which case the code will become really bulky.

Perhaps there is a better way to do what I am thinking of doing, but otherwise, help on this would be really appreciated.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to use array in QTP amit25007 2 3,345 01-25-2016, 05:10 PM
Last Post: amit25007
  Does QTP supports to open same application multiple times!!!!! pkiran169 1 3,018 08-07-2013, 01:09 PM
Last Post: anil2u
  Dynamically run QTP script on multiple servers arpan 8 7,127 06-21-2013, 06:34 PM
Last Post: arpan
  display any 10 numbers in ascending order using arrays in vb scripting haritha 4 24,423 01-03-2012, 05:46 PM
Last Post: shivu.hanu
  Storing data in excel sheet linhke 9 8,064 01-28-2010, 01:22 PM
Last Post: Saket

Forum Jump:


Users browsing this thread: 1 Guest(s)