Class: Array

Properties  Events  Methods    Index of Classes

Used to create a collection of values which are stored and accessed via item numbers

Hierarchy

cObject
---Array
------cCLIHandler
------cCollection
------cDFBtrDrvHandler
------DfBaseImageList
------Set
------ValidationTable

Library: Common (Windows and Web Application) Class Library

Package: none (class defined in runtime)

Description

For most purposes, developers should use the much more efficient native arrays and structs built into the DataFlex language.



The Array class is a general storage device. It is used to store all data types. Its size grows dynamically to accommodate the storage requirements. Data elements in the array are accessed by an integer index.

An array may store any type of data in any item. It is up to the program to know what the data-type of each item should be.

Each data item is accessed with the Value property. The number of elements in an array is maintained in the Item_count propery. Array items may be sorted used the the Sort_items method.

Sample

Object oArray1 is a Array
End_Object

Procedure DoFillArray
     Integer iCounter

     Send Delete_Data of oArray1
     For iCounter from 0 to 100
           Set Value of oArray1 iCounter to (string(iCounter ) * "name")
     Loop
End_Procedure

Procedure DoShowArray
     Integer iCounter iItems
     String sValue

     Get Item_Count of oArray1 to iItems
     For iCounter from 0 to (iItems-1)
           Get Value of oArray1 iCounter to sValue
           showln sValue
     loop
End_Procedure