Recent

Author Topic: [SOLVED]TbufDataSet and setting compound keys  (Read 517 times)

micoudic

  • New Member
  • *
  • Posts: 30
[SOLVED]TbufDataSet and setting compound keys
« on: September 19, 2023, 09:49:43 am »
hi,
How to indicate keys (composed with 2 fields) in the bufdataset?
FYI, I use .dbf files and I was looking for a solution to be able to sort on calculated fields. I don't want to (can't) change everything to use an SQL database.
I rely on the bufdataset to display and update it, and I maintain my DBF tables in parallel.

The problem with bufdataset:
"Indexdefs" is grayed out in the IDE and cannot document "IndexName" and "IndexFileNames".
I tried this:
  on the "Indexdefs" line of the bufdataset, click on "..." and create an index by defining its name, its characteristics and the key fields,
then I document the "IndexName" property. The fields constituting the key are not displayed, and if I fill them in manually, everything disappears.
I tried to create this index by coding in my program.
The compilation runs fine, everything appears fine, but sorting on these keys does not work.
Thanks.
« Last Edit: September 20, 2023, 06:52:57 pm by micoudic »

Zvoni

  • Hero Member
  • *****
  • Posts: 2033
Re: TbufDataSet and setting compound keys
« Reply #1 on: September 19, 2023, 11:50:03 am »
hi,
How to indicate keys (composed with 2 fields) in the bufdataset?
FYI, I use .dbf files and I was looking for a solution to be able to sort on calculated fields. I don't want to (can't) change everything to use an SQL database.
I rely on the bufdataset to display and update it, and I maintain my DBF tables in parallel.

The problem with bufdataset:
"Indexdefs" is grayed out in the IDE and cannot document "IndexName" and "IndexFileNames".
I tried this:
  on the "Indexdefs" line of the bufdataset, click on "..." and create an index by defining its name, its characteristics and the key fields,
then I document the "IndexName" property. The fields constituting the key are not displayed, and if I fill them in manually, everything disappears.
I tried to create this index by coding in my program.
The compilation runs fine, everything appears fine, but sorting on these keys does not work.
Thanks.

https://www.freepascal.org/docs-html/fcl/bufdataset/tcustombufdataset.indexdefs.html
Quote
IndexDefs is a read-only TIndexDefs property that contains the index definitions for the buffered dataset.

How to create an Index for a dbf
http://www.dbase.com/help/Local_SQL/IDH_LSQL_CREATEINDEX.htm
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

micoudic

  • New Member
  • *
  • Posts: 30
Re: TbufDataSet and setting compound keys
« Reply #2 on: September 19, 2023, 09:29:21 pm »
Okay, I found a solution that works for me.
Thanks for the time spent

How do I mark the discussion "SOLVED"?
« Last Edit: September 19, 2023, 10:12:59 pm by micoudic »

Zvoni

  • Hero Member
  • *****
  • Posts: 2033
Re: TbufDataSet and setting compound keys
« Reply #3 on: September 20, 2023, 08:34:24 pm »
Okay, I found a solution that works for me.
Thanks for the time spent

How do I mark the discussion "SOLVED"?
„Modify“ your first post‘s subject line
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018