How to recalculate calcfields?
How to recalculate calcfields?
Hi, I need help.
I have a read-only query with calculated fields. In OnCalcField I'm accessing a global variable. This variable gets changed and I need to reflect this change in the grid - to recalculate calcfields in all visible records. How could I do it?
Thanks.
I have a read-only query with calculated fields. In OnCalcField I'm accessing a global variable. This variable gets changed and I need to reflect this change in the grid - to recalculate calcfields in all visible records. How could I do it?
Thanks.
With BDE I used following method programmed in subclass of TQuery:
procedure TExtQuery.RecalcAll;
var
i: integer;
begin
for i := 0 to self.BufferCount - 1 do begin
GetCalcFields(Buffers);
DataEvent(deRecordChange, 0); // to update on-screen components
end;
end;
It very often works also with SDAC, but sometimes it generates an assertion in MemLines.pas (source file of SDAC). Am I again douing something wrong?
procedure TExtQuery.RecalcAll;
var
i: integer;
begin
for i := 0 to self.BufferCount - 1 do begin
GetCalcFields(Buffers);
DataEvent(deRecordChange, 0); // to update on-screen components
end;
end;
It very often works also with SDAC, but sometimes it generates an assertion in MemLines.pas (source file of SDAC). Am I again douing something wrong?
I don't know a way to do it using public methods. For me, it would be sufficient to do it somehow, even using protected methods - but safe, without exceptions....
Yes, the exceptions appear more often when the filtered property is active, but i've already seen an exception without any filters or local sorting (i don't use local sorting at all - it wasn't supported by BDE
; It seems, that using my method i'm accessing some old, dead buffers, that are not filled by valid data anymore... - am I right? Do I have a way to decide, whether the buffer in the "buffers" array is valid or not?
Yes, the exceptions appear more often when the filtered property is active, but i've already seen an exception without any filters or local sorting (i don't use local sorting at all - it wasn't supported by BDE
