rbWiki > DADE > SQLBuilder > How To...Modify Search Criteria

How To...Modify Search Criteria

Table of contents
  1. 1. Question
  2. 2. Solution

Question

 "How can I modify SQL search criteria at run-time?"  

Solution

Use SQLBuilder to modify the SQL search criteria. The following example uses SQLBuilder and the Report.OnInitializeParameters event to display a simple input dialog and apply the results to the the SQL search criteria. Note that this is an alternative to using RB's built-in AutoSearch feature. 

Download: SQLBuilderSimpleModifySearchCriteria.zip

Delphi code sample

procedure TForm1.ppReport1InitializeParameters(Sender: TObject; var aCancel: Boolean);
var
  lSQLBuilder: TdaSQLBuilder;
  lsValue: string;
begin

 lsValue := '1221';

 InputQuery('Search Condition', 'Customr Number', lsValue);

 lSQLBuilder := TdaSQLBuilder.Create(ppReport1.DataPipeline);
 lSQLBuilder.SearchCriteria[0].Value := lsValue;
 lSQLBuilder.ApplyUpdates;
 lSQLBuilder.Free;

end;
Tags
none

Files (0)

 
You must login to post a comment.