Persistent fields are deleted after reopen

Clientdataset, persistent fields are automatically deleted after reopen

Clientdataset.Active: = FALSE;
ClientDataset.Active: = TRUE;

This means that it is not possible to work with persistent calculated fields (OnCalcFields). Fields that are present in the JSON response are automatically created again, But the calculated fields are then missing. It is therefore not possible to reopen an WebClientConnect and recive further data.

How can you get around this?

Does it make sense to implement the deletion of the fields in the ClientDataset.Active function?ake sense to implement the deletion of the fields in the ClientDataset.Active function?

Thanks Frank

It should be fixed in the upcoming release.

Is there a schedule for deploying the update? We cannot currently switch to version 1.3.8 because our application is not executable.

thank you

The next release will be v1.4.
There is not yet a fixed date for this release. We are working very hard to have this ready as soon as possible.

The error "No field found" is also present in Beta 1.4.

What is the correct procedure if you get empty JSON responses from the server, or if fields are only available if they also have a meaningful value?

response = []

Do you initialize the fields yourself first then?

If a problem persists, please provide a sample source project + detailed steps with which we can reproduce the problem.

These are persistent fields that are created during design time. We also use cac fields that were also created using the field editor.

This was retested and we are unable to reproduce.

Test performed with the DataSet demo under Demo\Basics\Dataset


  WebClientConnection1.DataNode := 'ROW';
  WebClientDataSet1.FieldDefs.Clear;
  WebClientDataSet1.FieldDefs.Add('_Species_No',ftString,0);
  WebClientDataSet1.FieldDefs.Add('_Category',ftstring,50);
  WebClientDataSet1.FieldDefs.Add('_Common_Name',ftstring,50);
  WebClientDataSet1.FieldDefs.Add('_Species_Name',ftstring,50);
  WebClientDataSet1.FieldDefs.Add('Length__cm',ftInteger,0);
  WebClientDataSet1.FieldDefs.Add('_Length_In',ftString,30);
  WebClientDataSet1.FieldDefs.Add('_Notes',ftString,255);
  WebClientConnection1.Active := true;
  WebButton1.Enabled := false;

This loads an empty JSON array and works without errors.

We repeated the same test by adding all fields as persistent fields to the dataset and it still works without any error.

Are you sure you fully uninstalled v1.3.8.0?


Found cause:
If WebClientConnection.AutoOpen DataSet = Active, the defined fields are deleted when the request is executed again. This is remedied by setting AutoOpenDataSet = FALSE and manually controlling the TWebClientDataSet.

I cannot assess whether this behavior is correct. For me this is the solution.

Tested with Version 1.4.0. (Beta)

I cannot reproduce this or I do not fully understand what you are doing.


I changed in the Demo\Basics\Dataset project the button click event handler to

procedure TForm1.WebButton1Click(Sender: TObject);
begin
  WebClientConnection1.Active := false;
  WebClientConnection1.DataNode := 'ROW';
  WebClientConnection1.Active := true;
end;

so this performs a new request on every click and this keeps working with the persisted fields.