Using the same modified sample app as in https://support.tmssoftware.com/t/how-to-make-persistent-copy-of-dataset-for-offline-or-later-viewing/25620/1 I added the following line just before the "Make a clone..." comment:
WebClientDataSet1.GetFieldNames(LFieldNames);
where LFieldNames: TStringList;
. This compiles but fails with the following console error:
Shouldn't this work? If not, what have I mistaken?
I cannot see any problem. Full code of test:
procedure TForm1.WebButton1Click(Sender: TObject);
begin
WebClientConnection1.URI := 'https://download.tmssoftware.com/tmsweb/fishfacti.json';
WebClientConnection1.DataNode := 'ROW';
WebClientConnection1.AutoOpenDataSet := true;
WebClientConnection1.Active := true;
end;
procedure TForm1.WebButton2Click(Sender: TObject);
var
sl: TStringList;
begin
clone := TWebClientDataSet(WebClientDataSet1.GetClonedDataSet(true));
sl := TStringList.Create;
clone.GetFieldNames(sl);
weblistbox1.Items.Assign(sl);
sl.Free;
end;
Thank you, Bruno. My problem wasn't actually related to cloning--it was due to my forgetting to Create
the TStringList after only declaring it in the var
list. Too corrupted by inline var
use, I guess. 