Pascal Recordset

I was wondering if there is a way to make a set of records in pascal. I look all over the internet and find it impossible.

type    
  TRecord = record
    StrField: string;
    IntField: Integer;
  end;

  TSetOfRecord = set of TRecord;         
+5
source share
2 answers

Assume that items that cannot be set must be of an ordinal type. As far as I remember, you can only have a limited number of participants, 255 a bell rings.

This seems to be more combinations than in your record, although it is unclear what determines the uniqueness for the member.

+5
source

"Recordset" does not make sense. You probably mean "collection of records." In this case, you can implement it in more than one way.

" " ( , " " ).

, :

function RecordInCollection(const ARecord: TYourRecord; const ACollection: array of TYourRecord): Boolean;
var
  Index1: Integer;
begin
  Result := False;
  for Index1 := Low(ACollection) to High(ACollection) do begin
    Result := (ACollection[Index1].StrField = ARecord.StrField) and (ACollection[Index1].IntField = ARecord.IntField);
    if Result then Exit;
  end;
end;

:

RecordInCollection (Record1, [Record2, Record3, Record4])

[Record2, Record3, Record4].

+1

All Articles