Recent

Author Topic: TmemTable has not onCalcFields event?  (Read 836 times)

dpap

  • Jr. Member
  • **
  • Posts: 52
TmemTable has not onCalcFields event?
« on: February 02, 2025, 09:19:30 pm »
I want to use a TMemTable for temporary record storing but, as I saw, doesn't exist a onCalcFields. Is there a similar memTable (or can I add) this event?

Zvoni

  • Hero Member
  • *****
  • Posts: 2895
Re: TmemTable has not onCalcFields event?
« Reply #1 on: February 03, 2025, 08:49:36 am »
I want to use a TMemTable for temporary record storing but, as I saw, doesn't exist a onCalcFields. Is there a similar memTable (or can I add) this event?

There is no TMemTable.
Do you mean TMemDataset?

And why would you expect an OnCalcFields-Event?
https://wiki.freepascal.org/TMemDataset (Yes, i know: Wiki is not Documentation, but i was too lazy to search further)

Quote
A TMemDataset descendant acts like a cursor on a table or query-result.
There are no calculated fields in a QUERY-RESULT
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

dpap

  • Jr. Member
  • **
  • Posts: 52
Re: TmemTable has not onCalcFields event?
« Reply #2 on: February 03, 2025, 10:17:34 am »
Yes, I mean TmemDataset. I want to have some fields in the table that act as lookup fields, and due to TmemDataset's lack of ability to have lookup fields, I plan to calculate them in the onCalcFields event using the locate method.
Yes, I know I can write a function that calculates these values ​​when needed, but I would prefer the onCalcFields event.

wp

  • Hero Member
  • *****
  • Posts: 12677
Re: TmemTable has not onCalcFields event?
« Reply #3 on: February 03, 2025, 10:44:17 am »
Maybe you should try TBufDataset. It is a memory table, too, but is more complete.

dpap

  • Jr. Member
  • **
  • Posts: 52
Re: TmemTable has not onCalcFields event?
« Reply #4 on: February 04, 2025, 08:38:50 am »
I know this but TBufDataset needs a file to write/read and this is not convenient for me

Thaddy

  • Hero Member
  • *****
  • Posts: 16633
  • Kallstadt seems a good place to evict Trump to.
Re: TmemTable has not onCalcFields event?
« Reply #5 on: February 04, 2025, 09:33:02 am »
I know this but TBufDataset needs a file to write/read and this is not convenient for me
To my knowledge that is not true.
Just call Buffdataset.CreateDataset; // I tested that just now!!
It does not need a filename.
And the use of Tmemtable is discouraged anyway.
The code should be marked as deprecated.
« Last Edit: February 04, 2025, 12:05:50 pm by Thaddy »
But I am sure they don't want the Trumps back...

egsuh

  • Hero Member
  • *****
  • Posts: 1555
Re: TmemTable has not onCalcFields event?
« Reply #6 on: February 09, 2025, 08:46:27 am »
TMemDataSet does not, but TBufDataSet has OnCalcFields event handler. So, you should use TBufDataSet. You do not need a file for it.

 

TinyPortal © 2005-2018