Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnFilterRecord event

Status
Not open for further replies.

auditdi30

Programmer
Feb 25, 2009
39
NO
Hello!

Is it possible to change the code I put in this event at runtime?? My code is at start;

accept:=dataset['navn']=form1.stat.panels[0].text;

but at runtime when user click on a button, I want to change the code to;

accept:=dataset['avrdato']>fra;

Is it possible, and if so, how??

TIA
Kåre!
 
One option is to store the field name in a variable and the value you're comparing in a variable.

Code:
accept := dataset[FieldToCompare] > ValueToCompare;

This code, however, would only compare using the '>' operator. So you might add something like:

Code:
var
  Operator: integer; //or a type

case aOperator of
  Eq: accept := dataset[FieldToCompare] = ValueToCompare;
  Gt: accpac := dataset[FieldToCompare] > ValueToCompare;
  GtE: accpac:= dataset[FieldToCompare] >= ValueToCompare;
  Ne: accpac := dataset[FieldToCompare] <> ValueToCompare;
end;

 
@DjangMan - looks like there might be some Fortran in your past... ;-)

Roo
Delphi Rules!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top