whoops, forgot you have to include this line before the "for" clause:
   aRecord:= VarArrayCreate([0, Dataset.FieldCount-1], varVariant); 
 
A. G;


>________________________________
> From: Alejandro Gonzalo <[email protected]>
>To: Lazarus mailing list <[email protected]> 
>Sent: Saturday, February 16, 2013 4:09 PM
>Subject: Re: [Lazarus] Getting a Field list of a record
>  
>
>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 <[email protected]>
>>To: Lazarus mailing list <[email protected]> 
>>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
>>[email protected]
>>http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>>
>>   
>--
>_______________________________________________
>Lazarus mailing list
>[email protected]
>http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
>   
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to