4D v13.4Data Types |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
Data Types
|
Field | Variable | Expression | |
String (see note 1) | Yes | Yes | Yes |
Number (see note 2) | Yes | Yes | Yes |
Date | Yes | Yes | Yes |
Time | Yes | Yes | Yes |
Boolean | Yes | Yes | Yes |
Picture | Yes | Yes | Yes |
Pointer | No | Yes | Yes |
BLOB (see note 3) | Yes | Yes | No |
Array (see note 4) | No | Yes | No |
Integer 64 bits (see note 5) | Yes | No | No |
Float (see note 5) | Yes | No | No |
Undefined | No | Yes | Yes |
Notes:
String is a generic term that stands for:
A string is composed of characters. The handling of character strings varies depending on whether 4D is run in Unicode mode or in non-Unicode mode (compatibility mode). This mode is set via the application Preference (see the ASCII Codes section).
Unicode Mode
Non-Unicode Mode (compatibility)
Each character can be one of the 256 ASCII characters supported by Windows and Mac OS. For more information about ASCII codes, please refer to the ASCII Codes section.
No matter what the mode, you can assign a string to a text field and vice-versa; 4D does the conversion, truncating if necessary. You can mix string and text in an expression.
Note: In the 4D Language Reference manual, both string and text parameters in command descriptions are denoted as String, except when marked otherwise.
Number is a generic term that stands for:
The range for the Real data type is ±1.7e±308 (15 digits)
The range for the Integer data type (2-byte Integer) is -32,768..32,767 (2^15..(2^15)-1)
The range for the Long Integer data type (4-byte Integer) is -2^31..(2^31)-1
You can assign any Number data type to another; 4D does the conversion, truncating or rounding if necessary. However, when values are out of range, the conversion will not return a valid value. You can mix Number data types in expressions.
Note: In the 4D Language Reference manual, no matter the actual data type, the Real, Integer, and Long Integer parameters in command descriptions are denoted as Number, except when marked otherwise.
Note: In the 4D Language Reference manual, Date parameters in command descriptions are denoted as Date, except when marked otherwise.
Note: In the 4D Language Reference manual, Time parameters in command descriptions are denoted as Time, except when marked otherwise.
A Boolean field, variable or expression can be either TRUE or FALSE.
Note: In the 4D Language Reference manual, Boolean parameters in command descriptions are denoted as Boolean, except when marked otherwise.
A Picture field, variable or expression can be any Windows or Macintosh picture. In general, this includes any picture that can be put on the pasteboard or read from the disk using 4D or Plug-In commands.
Note: In the 4D Language Reference manual, Picture parameters in command descriptions are denoted as Picture, except when marked otherwise.
A Pointer variable or expression is a reference to another variable (including arrays and array elements), table, or field. There is no field of type Pointer.
For more information about Pointers, see the section Pointers.
Note: In the 4D Language Reference manual, Pointer parameters in command descriptions are denoted as Pointer except when marked otherwise.
A BLOB field or variable is a series of bytes (from 0 to 2 GB in length) that you can address individually or by using the DISABLE MENU ITEM. There is no expression of type BLOB.
Note: In the 4D Language Reference manual, BLOB parameters in command descriptions are denoted as BLOB.
Array is not actually a data type. The various types of arrays (such as Integer Array, Text Array, and so on) are grouped under this title. Arrays are variables—there is no field of type Array, and there is no expression of type Array. For more information about arrays, see the section Arrays.
Note: In the 4D Language Reference manual, Array parameters in command descriptions are denoted as Array, except when marked otherwise (i.e., String Array, Numeric Array, ...).
Undefined is not actually a data type. It denotes a variable that has not yet been defined. A function (a project method that returns a result) can return an undefined value if, within the method, the function result ($0) is assigned an undefined expression (an expression calculated with at least one undefined variable). A field cannot be undefined.
The 4D language contains operators and commands to convert between data types, where such conversions are meaningful. The 4D language enforces data type checking. For example, you cannot write: "abc"+0.5+!12/25/96!-?00:30:45?. This will generate syntax errors.
The following table lists the basic data types, the data types to which they can be converted, and the commands used to do so:
Convert to | Convert to | Convert to | Convert to | |
String | Number | Date | Time | |
String | Num | Date | Time | |
Number (*) | String | |||
Date | String | |||
Time | String | |||
Boolean | Num |
Note: In addition to the data conversions listed inthis table, more sophisticated data conversions can be obtained by combining operators and other commands.
Product: 4D
Theme: Language definition
Arrays
Character Reference Symbols
Constants
Control Flow
Identifiers
Methods
Operators
Pointers
String
Type
Variables