TWideMemoField and TMemoField AsString
Posted: Fri Oct 05, 2018 8:10 am
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:
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