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

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

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

No comments:

Post a Comment