How to create a Data Type

If you find that a model is being used that lacks a particular data type, then you can either create a new data element from scratch or you can import one from another model or dataset.

Step-by-Step Guide

First make sure you have selected the DRAFT data model that you need to work with.

Click on the "Data Model" button on the menu bar at the top of the screen and select "New Data Type" from the dropdown list. 

Alternatively navigate to Data Types from the left hand menu and select "New Data Type" from the top menu OR select the green plus button at the bottom of the list of existing Data Types.

This will bring up a dialog box:


Fill in the name, leave the Catalogue ID blank as the system will generate this. Fill in the description.  Optionally one can then add a rule, either as a regular expression in the form:

x ==~ /[a-zA-Z0-9]{1,5}/ 

The regular expression between the two forward slashes in this case state that the datatype should consist of alpha-numeric characters in groups of between 1 and 5 in length, however you can enter anything that is parsed as a regular expression in groovy.

Or as a groovy script:

At the bottom row there is a set of radio buttons that specify the type of datatype, by default it is set to “simple”.  Most eventualities can be handled by a simple datatype and the appropriate rule, however the metadata exchange can add some extra functionality by defining a datatype as a simple datatype, an enumerated datatype, as a primitive, a reference or a subset. 

Simple DataType

In this particular example we may wish to define such a datatype as an enumeration, there is not a lot of difference between the two, except that an enumeration will function within the form generation plugins more effectively than defining a simple datatype and a rule such as this.

Enumerated DataType

In this particular example we may wish to define such a datatype as an enumeration, there is not a lot of difference between the two, except that an enumeration will function within the form generation plugins more effectively than defining a simple datatype and a rule such as this.


An Enumerated datatype or Enumeration allows one to specify a set of different values as a single datatype, and use a short form to access them by storing them as a key-value set. So in the previous example, instead of storing the word ‘Apple’ as a string, we simply store A as a key that can then access the value ‘Apple’.  This enables us to reduce storage space, and in the case of the catalogue we can use the ‘enumerated’ datatype to generate input forms for such datatypes.

Primitive DataType

A primitive is referenced to a measurement unit, for instance the measurement unit for length is defined as a separate entity, however it can be referenced by a primitive datatype based on an integer, or perhaps based on another datatype such as ‘float’.

The wizard for creating a primitive datatype also allows for the creation of a Measurement Unit during the course of filling in the dialog box details if there is not already an existing Measurement Unit in the data model.

Reference DataType

A datatype can also be specified as a ‘reference’ to an existing DataClass, in which case we select the reference option.


 









Subset DataType

This can be used when you need an enumeration which is a subset of an existing enumeration, just by selecting the values you want you can create the new enumerated datatype.