Platoo DynFilter TDynFilter

Contents - Events - Methods - Properties

Dynamic filter for TDataSet


Description
Simplifies creating and managing runtime by user-changeable filters.

Usually, no one line of code-writing is needed to realize the data filtering interface for the end-user.

Various filter operations: =, >, <, >=, <=, <>, begins, contains, partial match; case on/off, etc.

Various user interface components:

TDynFilterEdit , TDynFilterEditBtn , TDynFilterCheckBox , TDynFilterComboBox , TDynFilterRadioGroup , TDynFilterDBCombo .


TDynFilter - Events

Contents - TDynFilter - Properties - Methods

OnRefreshData
Data refresh event

Delphi declaration
property OnRefreshData: TDfRefreshDataEvent read FOnRefreshData write FOnRefreshData;
C++ declaration
__property TDfRefreshDataEvent OnRefreshData={ read=FOnRefreshData, write=FOnRefreshData }

Description
Forced before the filter calls the DataSet-s Refresh method.

If you prefer some other method instead of the internal DataSet->Refresh, then this is the right place.


TDynFilter - Methods

Contents - TDynFilter - Properties - Events

~TDynFilter
Destructor

C++ declaration
__fastcall virtual ~TDynFilter(void)

Clear
Clear all filterconditions

Delphi declaration
procedure Clear;
C++ declaration
void __fastcall Clear(void)

Description
Forces Refresh .

Create
Delphi declaration
constructor Create(AOwner: TComponent);
Destroy
Delphi declaration
destructor Destroy;
DFTextToDate
Internal string to date conversion

Delphi declaration
function DFTextToDate(const sText: string): TDateTime;
C++ declaration
System::TDateTime __fastcall DFTextToDate(const System::AnsiString sText)

DFTextToNumeric
Internal string to numeric conversion

Delphi declaration
function DFTextToNumeric(const sText: string; const bDecimalsEnabled: Boolean): Double;
C++ declaration
double __fastcall DFTextToNumeric(const System::AnsiString sText, const bool bDecimalsEnabled)

Description
bDecimalsEnabled FALSE disables decimal places (used in the case of integers)

InternalUpdateFilter
Internal filter refresh

Delphi declaration
procedure InternalUpdateFilter;
C++ declaration
void __fastcall InternalUpdateFilter(void)

IsCompatibleField
Field compatibility check

Delphi declaration
function IsCompatibleField(Field: TField): Boolean;
C++ declaration
bool __fastcall IsCompatibleField(Db::TField *Field)

Description
TDynFilter cannot be used for calculated and lookup fields.

Notification
Overrides the inherited method to respond to opRemove notifications on the linked DataSet.

Delphi declaration
procedure Notification(AComponent: TComponent; Operation: TOperation);
C++ declaration
virtual void __fastcall Notification(Classes::TComponent *AComponent, Classes::TOperation Operation)

PartialStrCompare
Internal advanced string comparing function

Delphi declaration
function PartialStrCompare(const sString1: string; const sCondString: string): Boolean;
C++ declaration
bool __fastcall PartialStrCompare(const System::AnsiString sString1, const System::AnsiString sCondString)

Description
Used, when the operation is foPartialMatch.

Refresh
Refresh dataset immediately

Delphi declaration
procedure Refresh;
C++ declaration
void __fastcall Refresh(void)

Description
Usable, if AutoRefresh=false.

SetAllFilterBoolCond
Setting all filterconditions for Boolean-field at the same time

Delphi declaration
procedure SetAllFilterBoolCond(const FieldName: string; const ComponentName: string; const bCondBoolType: Boolean; const Value: Boolean);
C++ declaration
void __fastcall SetAllFilterBoolCond(const System::AnsiString FieldName, const System::AnsiString ComponentName, const bool bCondBoolType, const bool Value)

Description
Forces UpdateFilter

SetAllFilterCond
Setting all filterconditions for field at the same time, condition as string

Delphi declaration
procedure SetAllFilterCond(const FieldName: string; const ComponentName: string; const sCondString: string; const bCaseInsensitive: Boolean; const iFilterOperation: TDynFilterOperation; const bCompareOrdValues: Boolean; const bCompareEmptyValue: Boolean);
C++ declaration
void __fastcall SetAllFilterCond(const System::AnsiString FieldName, const System::AnsiString ComponentName, const System::AnsiString sCondString, const bool bCaseInsensitive, const TDynFilterOperation iFilterOperation, const bool bCompareOrdValues, const bool bCompareEmptyValue)

Description
Forces UpdateFilter

TDynFilter
Constructor

C++ declaration
__fastcall virtual TDynFilter(Classes::TComponent *AOwner)

UpdateFilter
Refresh dataset, if AutoRefresh=true

Delphi declaration
procedure UpdateFilter;
C++ declaration
void __fastcall UpdateFilter(void)

Description
Case of AutoRefresh =false does nothing!


TDynFilter - Properties

Contents - TDynFilter - Methods - Events

AutoRefresh
Refresh filtered DataSet immediately after every filter change

Delphi declaration
property AutoRefresh: Boolean read FAutoRefresh write FAutoRefresh default true;
C++ declaration
__property bool AutoRefresh={ read=FAutoRefresh, write=FAutoRefresh, default=1 }

Description
In the case AutoRefresh=FALSE, you can change more filterconditions and then call DynFilter ->Refresh();

In the case AutoRefresh=TRUE, every change refreshes the filtered DataSet.

Remark: Setting AutoRefresh property to TRUE doesn't force DynFilter->Refresh!

CaseInsensitive
Case-property for field filtercondition

Delphi declaration
property CaseInsensitive[const FieldName: string]: Boolean read GetCaseInsensitive write SetCaseInsensitive;
C++ declaration
__property bool CaseInsensitive[System::AnsiString FieldName]={ read=GetCaseInsensitive, write=SetCaseInsensitive }

Description
Usable, when comparing as string

CompareEmptyValue
Compare-to-empty value property for field filtercondition

Delphi declaration
property CompareEmptyValue[const FieldName: string]: Boolean read GetCompareEmptyValue write SetCompareEmptyValue;
C++ declaration
__property bool CompareEmptyValue[System::AnsiString FieldName]={ read=GetCompareEmptyValue, write=SetCompareEmptyValue }

Description
If set, empty fieldcondition will be compared against the empty fieldvalue,

otherwise, an empty fieldcondition means that no condition is set.

CompareOrdValues
Compare ordinal value property for field filtercondition

Delphi declaration
property CompareOrdValues[const FieldName: string]: Boolean read GetCompareOrdValues write SetCompareOrdValues;
C++ declaration
__property bool CompareOrdValues[System::AnsiString FieldName]={ read=GetCompareOrdValues, write=SetCompareOrdValues }

Description
If false, compared as string

CondAsBoolFalse
Boolean-false condition value for field filtercondition

Delphi declaration
property CondAsBoolFalse[const FieldName: string]: Boolean read GetCondAsBoolFalse write SetCondAsBoolFalse;
C++ declaration
__property bool CondAsBoolFalse[System::AnsiString FieldName]={ read=GetCondAsBoolFalse, write=SetCondAsBoolFalse }

Description
Used in pair with CondAsBoolTrue.

CondAsBoolTrue
Boolean-true condition value for field filtercondition

Delphi declaration
property CondAsBoolTrue[const FieldName: string]: Boolean read GetCondAsBoolTrue write SetCondAsBoolTrue;
C++ declaration
__property bool CondAsBoolTrue[System::AnsiString FieldName]={ read=GetCondAsBoolTrue, write=SetCondAsBoolTrue }

Description
Used in pair with CondAsBoolFalse.

CondAsDateTime
Condition value for field filtercondition as TDateTime

Delphi declaration
property CondAsDateTime[const FieldName: string]: TDateTime read GetCondAsDateTime write SetCondAsDateTime;
C++ declaration
__property System::TDateTime CondAsDateTime[System::AnsiString FieldName]={ read=GetCondAsDateTime, write=SetCondAsDateTime }

Description
Setting the parameter forces also the CondString parameter to be evaluated respectively.

CondAsFloat
Condition value for field filtercondition as double

Delphi declaration
property CondAsFloat[const FieldName: string]: Double read GetCondAsFloat write SetCondAsFloat;
C++ declaration
__property double CondAsFloat[System::AnsiString FieldName]={ read=GetCondAsFloat, write=SetCondAsFloat }

Description
Setting the parameter forces also the CondString parameter to be evaluated respectively.

CondAsInteger
Condition value for field filtercondition as integer

Delphi declaration
property CondAsInteger[const FieldName: string]: Longint read GetCondAsInteger write SetCondAsInteger;
C++ declaration
__property long CondAsInteger[System::AnsiString FieldName]={ read=GetCondAsInteger, write=SetCondAsInteger }

Description
Setting the parameter forces also the CondString parameter to be evaluated respectively.

CondStrings
Condition value for field filtercondition as string

Delphi declaration
property CondStrings[const FieldName: string]: AnsiString read GetCondStrings write SetCondStrings;
C++ declaration
__property System::AnsiString CondStrings[System::AnsiString FieldName]={ read=GetCondStrings, write=SetCondStrings }

Description
If ordinal comparing is required, string will be converted to adequate datatype (double, TDateTime, integer, boolean).

Empty condstring means that field filter is off (except, if compared to empty value).

DataSet
Filtered DataSet

Delphi declaration
property DataSet: TDataSet read FDataSet write SetDataSet nodefault;
C++ declaration
__property Db::TDataSet *DataSet={ read=FDataSet, write=SetDataSet, nodefault }

Description
Warning: filter hooks at runtime to DataSet's events OnFilterRecord and AfterOpen (old events will be replaced and called inside the filter)!

Therefore, it is not recommended to change DataSet's OnFilterRecord and AfterOpen events at runtime.

DefaultCaseInsensitive
Default case-property value for filterconditions

Delphi declaration
property DefaultCaseInsensitive: Boolean read FDefaultCaseInsensitive write FDefaultCaseInsensitive default true;
C++ declaration
__property bool DefaultCaseInsensitive={ read=FDefaultCaseInsensitive, write=FDefaultCaseInsensitive, default=1 }

DefaultCompareOrdValues
Default compare ordinal value property value for filterconditions

Delphi declaration
property DefaultCompareOrdValues: Boolean read FDefaultCompareOrdValues write FDefaultCompareOrdValues default true;
C++ declaration
__property bool DefaultCompareOrdValues={ read=FDefaultCompareOrdValues, write=FDefaultCompareOrdValues, default=1 }

DefaultFilterOperation
Default filter operation for filterconditions

Delphi declaration
property DefaultFilterOperation: TDynFilterOperation read FDefaultFilterOperation write FDefaultFilterOperation default foContains;
C++ declaration
__property TDynFilterOperation DefaultFilterOperation={ read=FDefaultFilterOperation, write=FDefaultFilterOperation, default=0 }

FilterActive
Switch DynFilter filtering on/off

Delphi declaration
property FilterActive: Boolean read FFilterActive write SetFilterActive default true;
C++ declaration
__property bool FilterActive={ read=FFilterActive, write=SetFilterActive, default=1 }

Description
Doesn't affect other DataSet filters.

FilterOperation
Filteroperation for field filtercondition

Delphi declaration
property FilterOperation[const FieldName: string]: TDynFilterOperation read GetFilterOperation write SetFilterOperation;
C++ declaration
__property TDynFilterOperation FilterOperation[System::AnsiString FieldName]={ read=GetFilterOperation, write=SetFilterOperation }

IgnoreOnPartialMatch
Words (phrases) ignored by foPartialMatch

Delphi declaration
property IgnoreOnPartialMatch: TStrings read FIgnoreOnPartialMatch write SetIgnoreOnPartialMatch;
C++ declaration
__property Classes::TStrings *IgnoreOnPartialMatch={ read=FIgnoreOnPartialMatch, write=SetIgnoreOnPartialMatch, nodefault }

InternalTxtFloatDateConv
Use internal text -to-date and text -to-float conversions instead of standard

Delphi declaration
property InternalTxtFloatDateConv: Boolean read FInternalTxtFloatDateConv write FInternalTxtFloatDateConv default false;
C++ declaration
__property bool InternalTxtFloatDateConv={ read=FInternalTxtFloatDateConv, write=FInternalTxtFloatDateConv, default=0 }

Description
TDynFilter has internal converters for txt<->numeric and txt<->date.

Internal date format is "dd[[.mm].[yy]yy]", a missing month and/or year will be replaced with the current.

Internal txt->numeric conversion accepts different decimal separators.

To switch to more standard methods, set InternalTxtFloatDateConv to FALSE;

(in this case methods like StrToFloat, StrToInt, StrToDate etc. are used).

LicenceKey
License key

Delphi declaration
property LicenceKey: TEKeyProp read FKeyProp write FKeyProp;
C++ declaration
__property Unkeyprop::TEKeyProp *LicenceKey={ read=FKeyProp, write=FKeyProp, nodefault }

ShowHourGlass
Show hourglass during DataSet refresh

Delphi declaration
property ShowHourGlass: Boolean read FShowHourGlass write FShowHourGlass default true;
C++ declaration
__property bool ShowHourGlass={ read=FShowHourGlass, write=FShowHourGlass, default=1 }