Record set example

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Wesley Baird

Record set example

Post by Wesley Baird » Sat 22 Jan 2005 22:40

Hi,

I have a record set in a crdbgrid where I want to have a ratio button that allows a user to display records where the field value is equal to YES or NO without requerying the database. So, the crdbgrid would just display all rows where the field = YES or field = NO but the main query gets all of the rows (field=YES & NO). The main query takes a long time to run, so if all of the rows are available, I should not have to requery it just for a selection like this.

Is there an example of this some where?

thx,
wes

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Mon 24 Jan 2005 13:31

You can use TCRDBGrid local filtering, for example:

Code: Select all

begin
  CRDBGrid1.Filtered := False;
  CRDBGrid1.OptionsEx :=  CRDBGrid1.OptionsEx + [dgeLocalFilter]; //Default setting
  CRDBGrid1.Columns[1].FilterExpression := '= YES';
  CRDBGrid1.Filtered := True;
end;
If you need more info pls. see "Using Filter Bar of TCRDBGrid Component", "TCRColumn.FilterExpression" and "TCRDBGrid.OptionsEx" topics of ODAC help.

Wesley Baird

Post by Wesley Baird » Tue 25 Jan 2005 11:27

that was what I needed.

thx.

Post Reply