Data Dictionary macro facility

Data dictionary macro facility

The Unibase data dictionary has a macro facility. The macro facility works like an include macro in other languages leading to shorter and more reliable code.

It can be used in the attribute and index definition sections of a table definition.

Syntax:

macro ::== '<'<table> {<paramaters>}
<paramaters> ::== <string> {<paramaters>}

eg

<supplier FsupplierTypes

The supplier table would have the extended definition:

: supplier Ftypes

and in the attribute list:

type, 1 %1

The effect is that in the table definition for supplier you can have a macro substitution indicated in the declaration of the table name and then another table can include the attributes of (in this case) supplier but with a different substitution.

The same thing can be done with indexes.

This is particularly helpful when working with alias tables and you want them to remain consistent and valid when the real table is being changed.

NB. These are text substitutions. It is up to the parser to decide if they make sense.