Micro Focus QTP (UFT) Forums
Array - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Array (/Thread-Array)



Array - bfakruddin - 03-23-2009

Hello Friends,

By seeing Array... How can we say that array is static array or dynamic array...!

thanks & regards,
Baba Fakruddin.D


RE: Array - Tarik Sheth - 03-23-2009

Static Array:
Code:
Dim No_Passengers(3)
The No_Passengers can store 4 values.

Assigning values to the array
No_Passengers(0) = 1
No_Passengers(1) = 2
No_Passengers(2) = 3
No_Passengers(3) = 4


Dynamic Array (Value changes at the runtime)

In the below code the array will be vary depending on the roles exist for the user. This is dynamic array

Code:
Dim arrUserRoles()
If objChildWebTable.Count <> 0 Then
ReDim arrUserRoles(objChildWebTable.Count - 1)
    For intCount = 0 To objChildWebTable.Count - 1
        arrUserRoles(intCount) = objChildWebTable(intCount).GEtROProperty("outertext")
    Next
Else
    Reporter.ReportEvent micFail,"User Roles","Logged in User have no  roles in the drop down list"
End IF



RE: Array - sreekanth chilam - 03-23-2009

hi ,

I agree with Tariksheth anwser....

Static Array :
Array created by using Dim ( example: Dim str(3) ) since Array size is fixed.

Dynamic Array :
Array created by using ReDim ( example : ReDim arrUserRoles(objChildWebTable.Count - 1)
(since Array size is not fixed here & it varies dynamically)