Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Field type translation configuration

 Post Reply Post Reply
Author
Lauenstein Florian View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2015
Posts: 26
Post Options Post Options   Quote Lauenstein Florian Quote  Post ReplyReply Direct Link To This Post Topic: Field type translation configuration
    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. 
Back to Top
Lauenstein Florian View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2015
Posts: 26
Post Options Post Options   Quote Lauenstein Florian Quote  Post ReplyReply Direct Link To This Post Posted: 10 Oct 2015 at 10:42am
I added it to the Feature Requests to Data Modeler
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2345
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
Lauenstein Florian View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2015
Posts: 26
Post Options Post Options   Quote Lauenstein Florian Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2345
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Lauenstein Florian View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2015
Posts: 26
Post Options Post Options   Quote Lauenstein Florian Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jan 2016 at 5:48am
Hi,

In the DataModeler I create a table with these fields:

Price MONEY
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.
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2345
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 22 Jan 2016 at 8:17pm
Hi,

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)
Back to Top
Lauenstein Florian View Drop Down
New Member
New Member
Avatar

Joined: 02 Aug 2015
Posts: 26
Post Options Post Options   Quote Lauenstein Florian Quote  Post ReplyReply Direct Link To This Post 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).
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2345
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post 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;
begin
  Result := 'MSSQL2';
end;

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


then register it:

  TSQLGeneratorRegister.GetInstance.RegisterGenerator(TMyMSSQLGenerator.Create);

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

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


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down