Dictionary Changes
If I've changed the field aliases in a Dictionary, but I have lots of
report that are already written using the old field aliases, can I do
something at runtime in the that will force everything to refresh (I
don't want to untick all fields and then re-tick as this breaks links
between dataviews etc)?
As a temp test I've re-assigned the Close click on the File menu for the
Data tab to do:
lDataModule := daGetDataModule(Report);
if assigned(lDataModule) then
begin
gMetaDataManager.Clear;
for I := 0 to lDataModule.DataViewCount - 1 do
begin
lDataModule.DataViews[i].OutOfSync;
lDataModule.DataViews[i].Sync;
end;
end;
...but it doesn't work
Any suggestions?
TIA Paul
report that are already written using the old field aliases, can I do
something at runtime in the that will force everything to refresh (I
don't want to untick all fields and then re-tick as this breaks links
between dataviews etc)?
As a temp test I've re-assigned the Close click on the File menu for the
Data tab to do:
lDataModule := daGetDataModule(Report);
if assigned(lDataModule) then
begin
gMetaDataManager.Clear;
for I := 0 to lDataModule.DataViewCount - 1 do
begin
lDataModule.DataViews[i].OutOfSync;
lDataModule.DataViews[i].Sync;
end;
end;
...but it doesn't work
Any suggestions?
TIA Paul
This discussion has been closed.
Comments
anything I've missed or anything I'm doing that's not necessary:
procedure TnxRBDesignerEngine.DoDataModuleFieldsRefresh(Sender : TObject);
var
lDataModule : TdaDataModule;
i : Integer;
lSQL : TdaSQL;
lSQLBuilder : TdaSQLBuilder;
lDataView : TdanxQueryDataView;
begin
{get the datamodule}
lDataModule := daGetDataModule(Report);
if assigned(lDataModule) then
begin
for I := 0 to lDataModule.DataViewCount - 1 do
begin
lDataView := TdanxQueryDataView(lDataModule.DataViews[i]);
lDataView.Sync;
lSQL := lDataView.SQL;
lSQLBuilder := TdaSQLBuilder.Create(lSQL);
lSQLBuilder.SelectFields.Clear;
lSQLBuilder.SelectFields.AddAllFields;
lSQLBuilder.free;
end;
end;
end;
SIZE column for every field is set to 10! If I just popup the
QueryDesigner and close it (OK btn) then this gets corrected. Any
suggestions?
P.S. Core code refined to the following:
lDataView := TdanxQueryDataView(lDataModule.DataViews[i]);
lSQL := lDataView.SQL;
lSQLBuilder := TdaSQLBuilder.Create(lSQL);
lSQLBuilder.SelectFields.AddAllFields;
lSQLBuilder.ApplyUpdates;
lSQLBuilder.free;
Try calling SQL.Valid before making the call to ApplyUpdates. This will
refresh the field lengths before assigning the SQL object.
...
lSQLBuilder.SQL.Valid;
lSQLBuilder.ApplyUpdates;
...
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com