We have a TDAMemDataTable with some memo fields
At some point we want to see for which records this field has changed (before an apply)
We do this by comparing the value with OldValue
newvdm_info:=lWeegProtocol.vdm_Informatie.Text;
oldvdm_info:=Self.FieldByName(fld_WeegProtocolvdm_Informatie).OldValue;
if (newvdm_info<>oldvdm_info) then
However OldValue now always seem to contain null (same as Value)
Is this something that used to work?
What is the purpose of OldValue?
I am looking at a particular record in the dataset and am only interested in one field.
Is there an easy way to see if that field of that record is changed (via your delta system)?
Is it something we can use on client side? When is it set? What value does it contain?
Should we check all our code for use of OldValue and replace it?
Meanwhile I have tried your approach but unfortunately it crashes.
The s.Changed throws an exception probably because the field that is modified has âIog changesâ set to false. It is a field from a joined table which cannot be updated via the default RO update statement.
Looks like default solution that was implemented in Data.DB.pas doesnât work as expected so you canât use it.
why you can just use fld.OnChange event and set somewhere that this record was changed?
for example
procedure TForm124.DAMemDataTable1memChange(Sender: TDACustomField);
begin
if Sender.Value <> Sender.OldValue then
dictionary.AddOrSetValue(table.RecIDValue, True);
end;
i donât quite followâŚ
you state that we canât use the OldValue propertyâŚ
and then we should use the OldValue to check if the new value is different from the old one in the onchange event??
TDADataTable has a temporary buffer that stores old field values between Edit/Post operations:
procedure TDADataTable.InternalBeforeEdit(Sender: TDataset);
...
SetLength(fOldValues, Fields.Count);
for i := 0 to Length(fOldValues) -1 do
fOldValues[i] := Fields[i].Value;
end;
Note: it isnât original old value so it you change value twice, this OldValue will contain a value assigned in 1st edit