Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding array to another Global array in VB Script
#1
Solved: 10 Years, 9 Months, 1 Week ago
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??
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  String Array Declaration Bhuvana 0 915 01-07-2020, 12:59 PM
Last Post: Bhuvana
  Reading Global Sheet's DataTable Value Bhuvana 0 1,479 01-05-2020, 10:03 PM
Last Post: Bhuvana
  Error as Global Not defined while trying to retrieve value from Datatable siddharth1609 0 851 09-11-2019, 02:52 PM
Last Post: siddharth1609
  How To Capture Array Value into Excel Worksheet? Studymode 0 1,312 01-09-2018, 08:37 AM
Last Post: Studymode
  Pages and Frames adding _1, _2, _3... zunebuggy 1 1,511 05-30-2017, 12:17 AM
Last Post: Vichu M J

Forum Jump:


Users browsing this thread: 1 Guest(s)