Recent

Author Topic: OnFilterRecord  (Read 4342 times)

tatamata

  • Hero Member
  • *****
  • Posts: 804
    • ZMSQL - SQL enhanced in-memory database
OnFilterRecord
« on: July 28, 2011, 10:33:20 pm »
I have a question regarding OnFilterRecord event.
I know how to set one criteria, for example

Acceptable:=DataSet.FieldByName('MasterTableId').AsInteger=MasterTable.FieldByName('MasterTableId').AsInteger;               
But, how to set several filtering criteria at once? What if I have if...and...and...?
For Example, If filtering criteria is:
1. DataSet.FieldByName('Field1').AsInteger=MasterTable.FieldByName('FieldA').AsInteger;
AND
2. DataSet.FieldByName('Field2').AsInteger=MasterTable.FieldByName('FieldB').AsInteger;

mytimeman

  • New Member
  • *
  • Posts: 10
Re: OnFilterRecord
« Reply #1 on: August 05, 2011, 10:10:21 am »
As long as acceptable is set correctly at the end of the procedure I would have though you would be ok ?

so just

if (DataSet.FieldByName('Field1').AsInteger=MasterTable.FieldByName('FieldA').AsInteger)
and (DataSet.FieldByName('Field2').AsInteger=MasterTable.FieldByName('FieldB').AsInteger)
then
    acceptable := true
else
   acceptable := false;

or consolidated into

Acceptable := (DataSet.FieldByName('Field1').AsInteger=MasterTable.FieldByName('FieldA').AsInteger)
and (DataSet.FieldByName('Field2').AsInteger=MasterTable.FieldByName('FieldB').AsInteger);

or am I missing the question detail ?


 

TinyPortal © 2005-2018