How to force the businessrule.calcfields

is there a way to have the
TDADataTableRules.OnCalcFields(Sender: TDADataTable)
invoked even when there are no calculated fields defined in the DaSchema?

i tried to set the field for which i want to alter the value to calculated but that does not seem to work

Self.FindField(fld_MyField).Calculated := True;

what are the conditions for which the TDADataTableRules.OnCalcFields is called?

Hi,

You can have calculated fields in table on client-side and don’t have them in schema on server-side.

we call TDADataTableRules.OnCalcFields when standard TDataset.OnCalcField is fired.

You can look at Data.DB.pas sources for more details

so how?
since i only have the fields after opening the Tdamemdataset (created at runtime)
setting the field.calculated does not do the trick…

Hi,

try to declare fields before opening dataset like

table.Close;

with table.Fields.Add do ...
with table.Fields.Add do ...
with table.Fields.Add do ...

table.Open;

well i was looking for a way to get an oncalc event fired for a DaSchema table field…
so a sql existing one which i could change based on the oncalc event and based on other fields of that record…
i guess that is not possible…(without defining a dummy column for it and duplicating data)
since this is a boolean field regular grid ongettext events do not work either…

solved in sql

1 Like