Refresh a page of report with changed data
Hi,
I have set up DrawCommandClick/DrawCommandCreate events so I can click on a
line item on my report and do something, one of which updates the
corresponding dataset record with a flag i.e.
procedure
TFormRptRbPalletsInStoreNew.dbtPalletNumberpCatDrawCommandClick(Sender,
aDrawCommand: TObject);
....
if cdsPacking.Locate('PalletNumber',
fLoadoutForm.QryLink.FieldByName('PalletNumber').AsInteger, []) then
begin
cdsPacking.Edit;
cdsPacking.FieldByName('PreAllocated').AsString := 'T';
cdsPacking.Post;
end;
....
end;
- all good
I have an OnGetText handler set up that does the following....
if cdsPacking.FieldByName('PreAllocated').AsString = 'T' then
dbtPalletNumberpCat.Font.Color := clRed
else
dbtPalletNumberpCat.Font.Color := clBlack;
Is it possible to "refresh" my preview form's current page to reflect the
change in the underlying dataset. I currently have to scroll to the next
page of the report and then return to the current page to get the red
item(s) to draw.
TIA
I have set up DrawCommandClick/DrawCommandCreate events so I can click on a
line item on my report and do something, one of which updates the
corresponding dataset record with a flag i.e.
procedure
TFormRptRbPalletsInStoreNew.dbtPalletNumberpCatDrawCommandClick(Sender,
aDrawCommand: TObject);
....
if cdsPacking.Locate('PalletNumber',
fLoadoutForm.QryLink.FieldByName('PalletNumber').AsInteger, []) then
begin
cdsPacking.Edit;
cdsPacking.FieldByName('PreAllocated').AsString := 'T';
cdsPacking.Post;
end;
....
end;
- all good
I have an OnGetText handler set up that does the following....
if cdsPacking.FieldByName('PreAllocated').AsString = 'T' then
dbtPalletNumberpCat.Font.Color := clRed
else
dbtPalletNumberpCat.Font.Color := clBlack;
Is it possible to "refresh" my preview form's current page to reflect the
change in the underlying dataset. I currently have to scroll to the next
page of the report and then return to the current page to get the red
item(s) to draw.
TIA
This discussion has been closed.
Comments
I found this link on the RBWiki site...
http://www.digital-metaphors.com:8080/Delphi_Code/Formatting/How_To...Refresh_the_Report_After_a_Drawcommand_Click
which says include the following code in the OnDrawCommandClick event.....
ppReport1.Reset;
ppReport1.Engine.Reset;
TppDrawText(aDrawCommand).RedrawPage := True;
I found this worked but only if I had my report's CachePages property set to
false.
these newsgroups.
The CachePages option keeps a copy of each originally generated page in
memory so when the report is refreshed, the pages are not re-generated,
they are simply retrieved from memory.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com