File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,6 +180,30 @@ begin
180180end;
181181```
182182
183+ ### Step 6: Persist Data between Application Sessions
184+
185+ This step is applicable only to the memory-based [ TdxMemData] datasource.
186+
187+ To save the dataset to a file and restore data on app restart,
188+ handle ` OnCreate ` and ` OnDestroy ` events of the data module:
189+
190+ ``` pas
191+ const
192+ DataFileName = 'data.dat';
193+
194+ procedure TDataModule1.DataModuleCreate(Sender: TObject);
195+ begin
196+ if FileExists(DataFileName) then
197+ mdLayouts.LoadFromBinaryFile(DataFileName)
198+ end;
199+
200+ procedure TDataModule1.DataModuleDestroy(Sender: TObject);
201+ begin
202+ if mdLayouts.RecordCount > 0 then
203+ mdLayouts.SaveToBinaryFile(DataFileName)
204+ end;
205+ ```
206+
183207## Files to Review
184208
185209- [ uData.pas] /[ uData.cpp] stores dashboard layouts and supplies data to the dashboard.
You can’t perform that action at this time.
0 commit comments