613-518-1166 info@zimdatabases.com

ZIM Language Reference


< All Topics

Creates an object in an application directory.

Syntax #1

Creates an object in an application directory.

CREATE object name [IN dirname][$fn <filenumber>] [DELETE | KEEP]

CREATE object name [IN dirname]


One of
constant, directory, display, document, entityset, form, menu, relationship, role, set, variable, window
name The name to be given to object.
dirname The name of the application directory in which object is to be created. If dirname is not specified, object is created in the base application directory, called zim.
filenumber The number of the zim file created to contain the data. For example, if the CREATE command is invoked with $fn 400, Zim attempts to associate file zim0400 with the created object. It is sometimes useful to associate a particular filenumber with a particular object: if the object was erased with the KEEP option, the create command recreates it with the KEEP option.
DELETE When DELETE is specified, the existing database file, if present, is deleted before a new file is created. If DELETE is not specified and a file exists, an error message indicates that Zim is unable to create the object.
KEEP When KEEP is specified, the existing database file, if present, is kept instead of creating a new one. If the file does not exist, a new (empty) database file is created.

Syntax #2

Creates an index.

CREATE INDEX ownername.fieldname [UNIQUE]

Syntax #3

Creates a field.

CREATE FIELD ownername fieldname


ownername The name of the EntitySet, relationship with fields, or application document to which fieldname belongs.
fieldname The name of the field in ownername to index or to create.
UNIQUE If UNIQUE is specified, any duplicate key values are rejected and do not appear in the index.


The application directory named in a CREATE command must have been accessed in update mode (see ACCESS) and all information needed to define the object must exist in the Object Dictionary. For CREATE to proceed, the explicit dirname in the CREATE command (or the implicit directory zim) must match the owner-directory specified for object in the Object Dictionary; or, there must be no owner-directory specified for object in the Object Dictionary. In the latter case, object can be created in any or in every application directory available in the database (except foreign directories).

A field or form field cannot have the same name as an existing variable, EntitySet, relationship, role, directory, application document, window, constant, result set, form, menu, or display in the same application directory. Several fields or several form fields can have identical names, provided that each identically named field belongs to a different ownername.

There is an internal limit of 65000 CREATEs per Zim directory in Zim.  If this limit is exceeded, a 3029 error is generated. For more information, see Zim Error Codes.  To resolve this error, export all objects and import these objects into a newly initialized Zim database.  In a newly initialized database, the CREATE counter is reset to 0.


create entityset Employees in Personnel

Creates an EntitySet called Employees in the application directory Personnel.

create index Employees.FirstName

Creates an index for an un-indexed field FirstName in the Employees EntitySet.

See Also




Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents