Pages

Thursday, August 19, 2010

Array in Powerbuilder

Array is an indexed collection of elements of a single data type. An array can have one or more dimensions. One-dimensional arrays can have a fixed of variable size; multidimensional array always have a fixed size.

In Powerbuilder, any simple variable declaration becomes an array when you specify brackets [] after the variable name. For fixed-size arrays, you specify the sizes of the dimensions inside those brackets.

There are 2 types of array in Powerbuilder:
1. Variable Array
2. Fixed Array.

Samples in Powerbuilder script to declare an array

integer ali_number[ ] //Array of integers.
decimal {2} ald_harga[ ] // Array of decimal with 2 digits of precision
date ald_birthdate[ ] // array of date
integer ali_number[3] // fixed array of 3 integers
string als_daysname[7] // fixed array of 7 strings
integer ali_score[2,3] // 2 dimensional array of integer, means that we declare a 6-elements
long all_days[3,300,50] // 3 dimensional array of long, which have 45000 elements of array

There are 2 functions that provided for array data type in Powerbuilder: upperbound, lowerbound

1 comment: