A datastore is the interface object provided by ORDA to reference a database and access its model and data. In 4D v17, only the current database, returned by the ds command, is available as datastore.
Note: Datastore related methods and properties are detailed in the ORDA - DataStore chapter of the Language manual.
A datastore is made of a model and data:
- The model contains and describes all the dataclasses that make up the datastore. It is independant from the underlying database itself.
- Data refers to the information that is going to be used and stored in this model. For example, names, addresses, and birthdates of employees are pieces of data that you can work with in a datastore.
When handled through the code, the datastore is an object whose properties are all of the defined dataclasses. A datastore references only a single local or remote database.
The ds command returns a reference to the application's default datastore. When you call this command, 4D automatically references each table and field of the 4D database as attributes of the returned object:
- Tables are mapped to dataclasses.
- Fields are mapped to storage attributes.
- Records are mapped to entities.
- Relations are mapped to relation attributes - relation names, defined in the Structure editor, are used as relation attribute names.

The following rules are applied during conversion:
- Table, field, and relation names are mapped to object property names. If you want to use "dot notation" in ORDA, make sure that such names comply with general object naming rules, as explained in the Object property identifiers section.
Note: The "Manual" or "Automatic" property of relations has no effect in ORDA. - A datastore only references tables with a single primary key (see Primary keys). The following tables are not referenced:
- Tables without a primary key
- Tables with composite primary keys.
- BLOB type attributes are not managed in the datastore. BLOB type attributes are returned as Null in entities and cannot be assigned.
The datastore object itself cannot be copied as an object:
$mydatastore:=OB Copy(ds)
The datastore properties are however enumerable:
ARRAY TEXT($prop;0)
OB GET PROPERTY NAMES(ds;$prop)