Print Page | Close Window

Field type translation configuration

Printed From: TMS Software
Category: Business Tools
Forum Name: Data Modeler
Forum Discription:
Printed Date: 21 Feb 2020 at 4:21am

Topic: Field type translation configuration
Posted By: Lauenstein Florian
Subject: Field type translation configuration
Date Posted: 10 Oct 2015 at 10:31am
A big improvement to the Data Modeler would be in my eyes, if I could influence the translation of filed types in the configuration somewhere.

In the Table / Fields / Properties dialog there is a Physical type field, but it is disabled.

Very helpful would be a general translation table for each database type.

I miss the MS SQL filed types money, text and some more. 

Posted By: Lauenstein Florian
Date Posted: 10 Oct 2015 at 10:42am
I added it to the Feature Requests to Data Modeler

Posted By: Wagner R. Landgraf
Date Posted: 11 Oct 2015 at 11:17pm
Hello, sorry, but I could not understand exactly what you mean? The physical type field is enabled when you choose the data type as "computed". This way you can type anything you want for the field type/expression.
Is it what you were looking for?

Posted By: Lauenstein Florian
Date Posted: 19 Jan 2016 at 5:18pm
Inside the DataModeler I can choose the fieldtype money well, 
but when Aurelius expects or creates the field it is always a float type in MS SQL.

There is no way to create a money fieldtype on the database.
Even if I try the computed option as suggested.

Maybe this is a Aurelius issue?

Posted By: Wagner R. Landgraf
Date Posted: 19 Jan 2016 at 5:36pm
>>> There is no way to create a money fieldtype on the database.

On the database, or in the class? Still don't get it, if you are using Data Moduler, the field is already money in the database. Can you please give specific examples?

Posted By: Lauenstein Florian
Date Posted: 20 Jan 2016 at 5:48am

In the DataModeler I create a table with these fields:

Percent FLOAT

the resulting Aurelius class is always a double type.

    [Column('Price', [])]
    FPrice: Nullable<double>;
    [Column('Percent', [])]
    FPercent: Nullable<double>;

Further when I let create the mssql database with Aurelius the types are always float, 
Price float
Percent float

Even if I change the field type outside manually the manager claims a wrong format during the structure check.

But I would like to have the field Price as a currency type in my database and maybe in the Aurelius class too, like I defined in the DataModeler.

Posted By: Wagner R. Landgraf
Date Posted: 22 Jan 2016 at 8:17pm

we cannot change that otherwise we will break backward compatibility. But we have just released the 2.5 version of TMS Data Modeler which now allows you to specify the type of the property directly. So, the default is "Nullable<double>", but now you can go to the Aurelius export mapping and change it to "Nullable<Currency>" (or just "Currency" if you will)

Posted By: Lauenstein Florian
Date Posted: 26 Jan 2016 at 2:57am
Hi Wagner,

Thanks a lot, that's what I wanted.

But now I get an Aurelius error during the structure check like:

"Column Table.CurrField - Type mismatch. Existing: float. Target: NUMERIC($pre, $sca)"

Perfect would be in my eyes, if the expected field type in the database is MONEY as well, not NUMERIC(y, x).

Posted By: Wagner R. Landgraf
Date Posted: 26 Jan 2016 at 9:51pm
Hi Florian, again we can't change it because it will break backward compatibility. But you can create a new dialect that uses MONEY type instead of NUMERIC. This is more or less how to do it (not full code, just the key parts):

TMyMSSQLGenerator = class(TMSSQLSQLGenerator)
    procedure DefineColumnType(Column: TColumnMetadata); override;
    function GetSqlDialect: string; override;

function TMyMSSQLGenerator.GetSqlDialect: string;
  Result := 'MSSQL2';

procedure TMyMSSQLGenerator.DefineColumnType(Column: TColumnMetadata);
  case Column.FieldType of
    ftCurrency: Column.DataType := 'MONEY';
    inherited DefineColumnType(Column);

then register it:


and then when creating your IDBConnection interface, specify the 'MSSQL2' dialect to be used as the second parameter:

MyConnection := TFireDacConnectionAdapter.Create(FDConnection1, 'MSSQL2', False);

Print Page | Close Window