Page 1 of 1

TWideMemoField and TMemoField AsString

Posted: Fri Oct 05, 2018 8:10 am
by 18683216
Delphi version: Seattle (Not tested in Tokyo)
TTeeGrid version: VCL & FMX Registered version-1.06
Multidevice Application (FMX)
Platform: WIN32
DataSet:TFDQuery

Good Morning,

When a TField (associated with a TDataSet) belongs to one of these TWideMemoField or TMemoField classes, when calling the TVirtualDBData.AsString method, it does not return the contents of the field, it returns the text (WIDEMEMO), this happens because the method is being called TField.DisplayText and not TField.AsSTring.
I suggest you check the class and if it is one of the two classes that I mention, call the TField.AsString method.

The solution could be the following (it is the one I have in production), within the method TVirtualDBData.AsString:

Code: Select all

      // Eliminar esta linea
      //result:= tmp.DisplayText; // <-- return Field AsString
      // Substituirla por esta.
      if (tmp is TMemoField) or (tmp is TWideMemoField) then
        {REH FIX}{Si se utiliza DisplayText se obtiene la cadena '(WIDEMEMO)', en vez del contenido del campo.}
        result:=tmp.AsSTring // DisplayText muestra '(WIDEMEMO)'
      else
        result:= tmp.DisplayText; // <-- return Field AsString

Re: TWideMemoField and TMemoField AsString

Posted: Thu Oct 11, 2018 7:32 am
by Marc
Many thanks for the input. Change submitted as issue/fix: #2111

http://bugs.teechart.net/show_bug.cgi?id=2111

Regards,
Marc