[Lazarus] Getting a Field list of a record

Marcos Douglas md at delfire.net
Thu Feb 14 12:32:22 CET 2013


On Thu, Feb 14, 2013 at 8:00 AM, Johann Spies <johann.spies at gmail.com> wrote:
> I see TDataset has a method to get a list of fields. Is there something
> similar for type: record?
>
> Say for instance I want to check which fields of a record are empty, how can
> I do it without having to specify each field manually?
>
> Another example: If I want to compare two records of the same type to
> determine which fields differ.  How do I do it and get only a list of the
> fields involved?

Instead of record type, try to use TParams class.
The TParams has items of TParam. You can use methods to know if the
item is empty, casting .(AsInteger, .AsString,...), loop in all items
without specifying the names, etc

Marcos Douglas




More information about the Lazarus mailing list