title: Filter Query/DataSource records onto cxgrid
body: <p>Using Delphi XE2.</p>
  
  <p>Building a software package which connects to a database via query/datasource.</p>
  
  <p>I would like to implement a filter option for records in a table, so at a click of a button a cxgrid will then display the records which match the filter selections.</p>
  
  <p>I cant quite work out how to do this. Any help will be appreciated.</p>
  
  <p>Have this so far but I honestly don't if this is close to what im trying to achieve.</p>
  
  <pre><code>procedure TFilter.btnClick(Sender: TObject);
  begin
  with aQry do
  begin
    SQL.Clear;
    Close;
    SQL.Text := 'select * from TABLE where record_name like'+QuotedStr(name.Text+'%');
    SQL.Text := 'and record_type like '+QuotedStr(type.Text+'%');
    SQL.Text := 'and record_type2 like '+QuotedStr(type2.Text+'%');
    SQL.Text := 'and record_type3 like '+QuotedStr(type3.Text+'%');
    SQL.Text := 'and record_type4 like '+QuotedStr(type4.Text+'%');
    Open;
  end;
  end;
  </code></pre>