[Lazarus] Getting a Field list of a record

Alejandro Gonzalo parkingspace26 at yahoo.com
Sun Feb 17 01:09:44 CET 2013


You could use a variants instead of records, an enumeration list could keep track of the "field names".
Your user clause has to include variants.  Here is part of a procedure I used for another purpose:
 
var aRecord : variant;
      i : integer;
begin            
for i := 0 to Dataset.FieldCount-1 do
    aRecord[i]:= Dataset.Fields[i].Value;
 
A. G.

>________________________________
> From: Johann Spies <johann.spies at gmail.com>
>To: Lazarus mailing list <lazarus at lists.lazarus.freepascal.org> 
>Sent: Thursday, February 14, 2013 3:00 AM
>Subject: [Lazarus] Getting a Field list of a record
>  
>
>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?
>
>Regards
>Johann
>
>-- 
>Because experiencing your loyal love is better than life itself, 
>my lips will praise you.  (Psalm 63:3)
>
>--
>_______________________________________________
>Lazarus mailing list
>Lazarus at lists.lazarus.freepascal.org
>http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130216/22fbf1fc/attachment-0003.html>


More information about the Lazarus mailing list