Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-08

ftGuid displaytext & output

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

While trying to export dataset data to XML, I use this for ftGUID fields:

        FNode :=
Foutputdoc.CreateTextNode(Utf8decode(GUIDToString(TGuid(EF.Field.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

Reply by email

Ludo Brands
to Reinier Olislagers
Show quoted text 26 lines
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

Reply by email

Reinier Olislagers
to Ludo Brands
Ludo Brands wrote
TGuidField stores guid in the string format (GuidToString). EF.Field.AsString should give you the correct string value. Ludo

Thanks, Ludo.

I think I was using 'll have a further look; maybe I'm putting in rubbish; I'll probably have to assign the value to the field with something like GUIDToString...

Thanks,
Reinier

Reply by email