Micro Focus QTP (UFT) Forums
Adding array to another Global array in VB Script - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Adding array to another Global array in VB Script (/Thread-Adding-array-to-another-Global-array-in-VB-Script)



Adding array to another Global array in VB Script - test911 - 12-02-2012

Hi ALL,

I'm new to QTP and i'm facing the following problem:

i want to Get some data from multi pages
Navigate to (page 1) Then Get Data Then Click next
Get (Page 2) Data Then Click next and so on ...

The problem that i'm saving the data of the first page in an array when i go to the next page the array of the first page is deleted, i want to continue on the first array. i want to declare a global array and make it dynamic so every time i get the data i add this data to the global array

below is the code:


Code:
Dim arr

If Browser("test").Page("page").Exist(1) Then
        
While Browser("test").Page("page").Link("Next").Exist(1)         

arr= FuncGetData() 'Getdata in page to the array
                            Browser("test").Page("page").Link("Next").Click

Wend



Any help plz??


RE: Adding array to another Global array in VB Script - parminderdhiman84 - 12-02-2012

Code:
iRowIndex = 0
Redim arAllData(iRowIndex)
While Browser("test").Page("page").Link("Next").Exist(1)         

arr= FuncGetData() 'Getdata in page to the array

For i = 0 to ubound(arr)
  Redim Preserve arAllData(iRowIndex)
  arAllData(iRowIndex) = arr(i)
  iRowIndex = iRowIndex + 1    
Next
Browser("test").Page("page").Link("Next").Click

Wend