DataSets and page scripts
Documentation status: guide — see Maturity and evidence.
View scripts should work through page-level data surfaces rather than reaching directly into a provider for every interaction.
Resolve a DataSet by name
entityDataSet := Self.PageControler.DataSetsManager.DataSetByName('Entity');
A page-local validation can inspect the current view cache and decide whether a post is allowed:
entityDataSet := Sender.DataSetsManager.DataSetByName('Entity');
if entityDataSet.Amount = 0 then
begin
CanPost := false;
Message := 'An amount must be provided.';
end;
Refresh a dependent DataSet
items := Sender.DataSetsManager.DataSetByName('DataSetItems');
if Assigned(items) then
begin
items.Refresh();
end;
Design rule
DataSet events describe the state of the view cache first. Escalate to a conceptual action or service only when the interaction has application or business meaning.