Omitting fields with initial values
- Last Updated: January 17, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
When a field is defined, it gets an initial value either
by using the default initial value for the field's data type or
from the INITIAL option in the definition statement
or ADD-NEW-FIELD( ) method. The following
table shows the default initial values for ABL data types.
| Data type | Default initial value |
|---|---|
BLOB
|
Unknown value (?) |
CHARACTER
|
Empty string ("") |
CLOB
|
Unknown value (?) |
COM-HANDLE
|
Unknown value (?) |
DATE
|
Unknown value (?) |
DATETIME
|
Unknown value (?) |
DATETIME-TZ
|
Unknown value (?) |
DECIMAL
|
0 |
HANDLE
|
Unknown value (?) |
INT64
|
0 |
INTEGER
|
0 |
LOGICAL
|
No |
RAW
|
Zero-length sequence of bytes |
RECID
|
Unknown value (?) |
ROWID
|
Unknown value (?) |
Omitting initial value fields from your JSON can be useful if:
- Fields with initial values are not important to the business or application logic of your JSON consumer
- The JSON consumer knows how to recreate missing fields and populate them with initial values
To omit these fields, specify TRUE for the optional omit-initial-values argument
of the WRITE-JSON( ) method.
When working with large ProDataSets, omitting fields containing
their initial values can yield smaller JSON values, more efficient
network transfers, and performance gains with the READ-JSON( ) and WRITE-JSON( ) methods.
Although using the omit-initial-values
option can give your application performance and resource use improvements, you must be sure
that the consumers of the generated JSON output can correctly handle it. The ABL READ-JSON( ) method always populates created records with initial
values from the temp-table or ProDataSet definition. Other applications might not do this.