#1 2017-08-29 11:52:45

xchinjo
Member
From: Thailand
Registered: 2016-04-29
Posts: 41
Website

ToClientDataSet not support DECIMAL Fields

when use ToClientDataSet from mORMotMidasVCL.pas  TSQLFieldType  is not support DECIMAL fields


Jongruk Aripoo

Offline

#2 2017-08-29 12:11:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: ToClientDataSet not support DECIMAL Fields

Do you mean "decimal" in which context?
Our code handles sftCurrency kind of content, which holds number with fixed decimals.
If your TSQLTable has the expected type information for the columns, as input to ToClientDataSet function, there is no problem.

It is not clear what you meant here...

Offline

#3 2017-08-29 12:15:56

xchinjo
Member
From: Thailand
Registered: 2016-04-29
Posts: 41
Website

Re: ToClientDataSet not support DECIMAL Fields

GetDBFieldDef result sftUnknown


Jongruk Aripoo

Offline

#4 2017-08-29 12:18:44

xchinjo
Member
From: Thailand
Registered: 2016-04-29
Posts: 41
Website

Re: ToClientDataSet not support DECIMAL Fields

My Database Field Type is "Decimal(18,4)"

ab wrote:

Do you mean "decimal" in which context?
Our code handles sftCurrency kind of content, which holds number with fixed decimals.
If your TSQLTable has the expected type information for the columns, as input to ToClientDataSet function, there is no problem.

It is not clear what you meant here...


Jongruk Aripoo

Offline

#5 2017-08-29 12:21:38

xchinjo
Member
From: Thailand
Registered: 2016-04-29
Posts: 41
Website

Re: ToClientDataSet not support DECIMAL Fields

this my function

var
  Cds:TClientDataSet;
  i:integer;
begin
  Cds:=TClientDataSet.Create(nil);
  try
    JSONToClientDataSet(cds,GetDataSet(strSQL),nil,cdsNew,false);
    Result := cds.data;
  finally
    Cds.Free;
  end;
end;

Jongruk Aripoo

Offline

#6 2017-08-29 13:09:49

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: ToClientDataSet not support DECIMAL Fields

Your GetDataSet function is not setting the corresponding fields types.
Could you use the overloaded JSONToClientDataSet() function, and include the TSQLRecordClass information?

Offline

#7 2017-08-30 04:44:00

xchinjo
Member
From: Thailand
Registered: 2016-04-29
Posts: 41
Website

Re: ToClientDataSet not support DECIMAL Fields

@ab, Thank you  i will send small sample to you later.


Jongruk Aripoo

Offline

Board footer

Powered by FluxBB