Explanation
Creates an array object. The numeric value returned is a handle to the array object and must be preserved as this value must be provided when using the other array functions.
An array is a structure containing up to 64 items, indexed from 1..64. Each item in an array may contain is a double precision floating point numeric value. The other array functions provided allow you to set and retrieve individual values and sum or average contiguous elements in the array.
Arrays are useful for creating cross-tabulation type reports and for reporting data whose source is not known until run-time.
You may create up to a maximum 64 arrays in a single session, subject to available memory. It is important to remember to execute the KillArray function for each array you create when you are finished with them.
Example
Produce a sales performance report for the last six months by salesperson that lists each salesperson down the page with six columns, one for each of the past six months. Each column will contain the salesperson's total sales for that month.
Define "MonthlySales" number . Define "BaseMonth" number . Define "Month" number . Define "X" number .MonthlySales := InitArray ( ) . BaseMonth := Month(current date - (6.5*30)) . -- 6 month history For SalesPeople ; X := ZeroArray( MonthlySales) . For SalesTransactions ; Month := SalesMonth - BaseMonth . If Month > 0 then X := AssignArrayVal(MonthlySales, Month, SaleAmount+GetArrayVal(MonthlySales, Month)) . end . end .
List records SalesPersonName ; GetArrayVal(MonthlySales,1) ; GetArrayVal(MonthlySales,2) ; GetArrayVal(MonthlySales,3) ; GetArrayVal(MonthlySales,4) ; GetArrayVal(MonthlySales,5) ; GetArrayVal(MonthlySales,6) . end .
Explanation
Destroys the specified array structure. ArrayHandle is the value returned by InitArray and uniquely identifies the array structure.
Explanation
This function sets the value of an element in an array structure. ArrayHandle is the value returned by InitArray and uniquely identifies the array structure. Index identifies which element in the array (1-64) is to be assigned Value, which is a number.
Example
Assign the 12th item in the array 'JobUtilization' a value of 14.8972.
AssignArrayValue(JobUtilization, 12, 14.8972)
Explanation
Returns the value of the Index'th item in the array. ArrayHandle is the value returned by InitArray and uniquely identifies the array structure.
Example
Retrieve the value of the 12th item in the array 'JobUtilization'.
GetArrayValue(JobUtilization, 12)
Explanation
Returns the sums of values in the specified array starting with StartIndex through StopIndex. ArrayHandle is the value returned by InitArray and uniquely identifies the array structure.
Example
Sum the 6th through 12th items in the array 'JobUtilization' .
Total := SumRange(JobUtilization, 6, 12)
Explanation
Returns the mean of items in the specified array starting with StartIndex through StopIndex. ArrayHandle is the value returned by InitArray and uniquely identifies the array structure.
Example
Average the 6th through 12th items in the array 'JobUtilization' .
Mean := AvgRange(JobUtilization, 6, 12)
Explanation
Set all of an array's elements to a value of 0 . ArrayHandle is the value returned by InitArray and uniquely identifies the array structure.