Skip to content

Changing Field Data Types

Steve Ives edited this page Jan 17, 2020 · 4 revisions

It is possible to change the SQL data type used to expose fields. The main use case envisaged is to transform decimal fields into implied decimal fields by adding a number of decimal places in the database data, but there may be other use cases. For example the same mechanism could be used to transforming A1 Y/N fields into Boolean true/false fields in the database, and more.

To transform a field data type a developer must add various special tokens to the repository field definition, and specifically into the fields long description.

Let's take an example of a field that represents the price of a product that is stored in whole cents, in the actual application it is stored as a D6 value, which by default will be represented in the database as a SQL DECIMAL(6) value. When we replicate the data to the database our goal is to transform the value into a dollars and cents value, essentially a D6.2 that will be represented in the database as a DECIMAL(6,2). Here's how to achieve that:

In the repository, add the following information to the fields long description:

Clone this wiki locally