QRDesign dataset filter

Users can now filter a dataset before a report is generated in QRDesign 1.59

The feature of QRDesign 1.4 and earlier versions which allows a user to filter a dataset before the report is generated was not implemented fully in QR Design 1.59 at the time we acquired it. There is a straightforward workaround using the 'BeforeDatasetOpen' event which is called when the table or query is opened. The event code is listed below.

procedure TForm1.Designer1BeforeOpenDataset(DataSet: TDataSet);
begin
   if designer1.ShowFilterBeforePrint then
     begin
       filtdlg.Edit1.Text := dataset.Filter;
       filtdlg.ShowModal;
       if not filtdlg.cancel then
         dataset.Filter := filtdlg.Edit1.Text;
       end;
    end;

FiltDlg is a standard Windows dialog with an 'OK' button, a 'Cancel' button and an edit control ('Edit1') to allow the user to enter a new filter string.