Hiding field type

Sorry. Did not read your first message. If FInvoiceDate is not a persisted field, than to have it serialized you must use [XDataProperty] attribute:

[XDataProperty]  // this is missing
FinvoiceDate: Tdatetime;

I guess what you're really looking for (and Wagner pointed out) is something like:

  private
    [XDataExcludeProperty] 
    [FColumn('invoicedate')]
    FInvoiceDateStr: string;
  private
    function GetInvoiceDate: TDateTime;
    procedure SetInvoiceDate (const AValue: TDateTime);
  public
    [XDataProperty]
    property InvoiceDate: TDateTime read GetInvoiceDate write SetInvoiceDate;

(* ... *)

function TSomeObject.GetInvoiceDate: TDateTime;
var
  fs: TFormatSettings;
begin
  // set fs format as desired
  Result := StrToDate(FInvoiceDateStr, fs);
end;

procedure TSomeObject.SetInvoiceDate(const AValue: TDateTime);
begin
  FInvoiceDateStr := FormatDateTime('some-date-format', AValue);
end;

HTH,

1 Like