DIM varname AS type
DIM varArray(nnn) AS type
DIM varname AS type*length [,decimalPlaces]
DIM varArray(nnn) AS type*length[,decimalPlaces]
DIM varName AS DATABASE dbName, dbRec, dbLayout [, key]
Description
Defines a variable to be used within a function or subroutine. If the variable is an array , then nnn defines the number of elements to be reserved.
|
Type |
|
|
Byte |
a single character of data. On database input/output, a single character is written.(without the Terminating null character). |
|
Database |
used to define a database reference that will be used in database commands. If the database is to be bound to a grid control, additional arguments are needed. |
|
Date |
used to store date values. This is not the Palm internal format. Database i/o results in a 64-bit floating point number. Dates are stored internally as (year-1900)*10000+month*100+ day |
|
Double |
Same in all respects to Float |
|
Float |
used to store numbers that may have both integer and fractional digits. On input/output to databases, a 64-bit (8-byte) double precision floating point is used |
|
Integer |
used to store whole numbers (no decimal positions to the right of the decimal point). On input/output to databases, a 32-bit(4-byte) integer is used. |
|
Short |
Similar to Integer except that database i/o results in a 16-bit(2-byte). |
|
Single |
Same as Float except database i/o results in a 32-bit( 4-byte)single-precision floating point. |
|
String |
Maximum size is 32767 characters. |
|
Time |
used to store time values. This is not the Palm internal format. Databae i/o results in a 64-bit floating point number. Times are stored internally as hour*10000+minute*100+seconds |
|
UserType |
see the TYPE and END TYPE statements |
|
Variant |
see SysTrapFunc and SysTrapSub functions |
Length defines how many digits get displayed. DecimalPlaces is the number of digits to the right of the decimal point. This must be at least 2 less than length.
If we are declaring a database for use in a grid. VarName is the name of the variable. DbName is the name of the database on the Palm OS device. DbRec is a global variable which will be created to contain the contents of the current record of the database. It should not be dimensioned already. DbLayout is the layout of the record: it should already be defined using a TYPE statement. Key is an optional variable that must already be dimensioned: it is the key that is used for the dbName database. This form is only used to define Varname when used as the first argument of a BindToDataBase method for a Grid control.
Example
Dim income as float*12,2
Dim count as integer
Dim yesterday as date
Dim appt as time
Dim rates(12) as float
Dim Orders as database
Type dbBluesLayout
Name as String
age as Integer
active as Integer
End Type
Dim blueKey as Integer
Dim dbBlues1 as Database "Blues" Creator "Grid" Keyed With Record BlueKey, dbBluesRec as dbBluesLayout