[fpc-pascal] ftGuid displaytext & output
Ludo Brands
ludo.brands at free.fr
Sat Aug 13 13:04:31 CEST 2011
> While trying to export dataset data to XML, I use this for
> ftGUID fields:
>
> FNode :=
> Foutputdoc.CreateTextNode(Utf8decode(GUIDToString(TGuid(EF.Fie
> ld.Value))));
>
> This works on Windows 32 and shows a hex representation of
> the GUID, like {00000000-0000-0000-C000-000000000046}
>
> On Linux x64, I get: "Illegal type conversion: "Variant" to "TGuid""
>
> I then tried something like:
> FNode :=
> Foutputdoc.CreateTextNode(Utf8decode(EF.Field.DisplayText));
> However, this just output the GUID as a number (e.g. 42)
>
> 1. Is the conversion error I got due to the use of a 64 bit
> compiler? How can I fix it? (e.g. use EF.Field.AsLargeint -
> but that has 64 bits, not the the 128 bits present in a GUID)
>
> 2. Is the behaviour of .DisplayText correct for ftGUID
> variables - shouldn't it use GUIDToString to output the hex value?
>
> Thanks,
> Reinier
TGuidField stores guid in the string format (GuidToString).
EF.Field.AsString should give you the correct string value.
Ludo
More information about the fpc-pascal
mailing list