Author Topic: ZmemTable how to create composite key and find them?  (Read 237 times)


  • New Member
  • *
  • Posts: 39
ZmemTable how to create composite key and find them?
« on: July 21, 2023, 04:19:56 pm »
Hi All,

I´am trying to use zMemtable as Delphi Client Dataset, but it´s my first time with Zeos 8 Memtable, how Can I Create a dataset in runtime memory, create index and find key fields? I create this sample, but something is wrong, can you help me? Follow:
Code: Pascal  [Select][+][-]
  1. // sample
  2. zMemTable1.FilterOptions:=[foCaseInsensitive];
  3. zMemTable1.FieldDefs.Clear;
  4. zMemTable1.FieldDefs.Add('status', ftString, 3, False);
  5. zMemTable1.FieldDefs.Add('seq', ftInteger, 0, False);
  6. zMemTable1.FieldDefs.Add('filename', ftString, 1024, False);
  7. zMemTable1.FieldDefs.Add('filepath', ftString, 1024, False);
  8. //zMemTable1.CreateDataSet; // not exists CreateDataSet ?
  9. zMemTable1.Active:=true;
  10. zMemTable1.IndexFieldNames:='filename;filepath'; // is it right to use two fields?
  11. if not zMemTable1.FindKey(['arq.exe', 'c:\temp']) then // there is no FindKey?
  12. begin
  13.   // not found ...
  14. end;
In this sample does not exists zMemTable1.CreateDataSet, really not necessary?
In this sample I use zMemTable1.IndexFieldNames:='filename;filepath' to create a index with two fields(composite key), is it right?
in this example i try to lookup composite key according to IndexFieldNames method zMemTable1.FindKey(['arq.exe', 'c:\temp']), but there is not FindKey method, how to find them?

Any help will be welcome.


TinyPortal © 2005-2018