Tuesday 30 July 2013

How to create dynamic 2 dimensional array in QTP?

In QTP we can create dynamic array with any dimension.

Syntax -  To declare dynamic array is given below.

Dim a()

As shown above, we do not specify any dimension of array. 

To define the size of array we have to use below statement.
ReDim a(6,6)

In above statement, we have set the size of 2 dimensional array.

To preserve the existing data in array you must use below syntax.

ReDim preserve a(6,6)

Example to demonstrate 2 dimensional dynamic array is given below.


Dim a()

ReDim preserve a(6,6)

a(5,5) = array(12,33,454)

a(0,0) = array(2,3,4)

a(3,2) = 333

print a(5,5)(0)        ' prints 12



Please give your inputs, suggestions, feedback to Us. We value your thoughts.

No comments:

Post a Comment

Please Leave your reply. We value your feedback and inputs

Best QTP Books

Everything About QTP

Hello Friends,
You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.