Table of Contents

TTMSFNCFilterRulesManager.AddRule Method

Adds a rule with a raw filter-text expression; returns the new rule.

API unit family: TMS.TMSFNCFilterRulesManager Declaring type: TTMSFNCFilterRulesManager Inherited from: TTMSFNCCustomFilterRulesManager

Overloads

Overload 1

Adds a rule with a raw filter-text expression; returns the new rule.

function AddRule(const AName: string; ASource: TComponent; const AItemsPath: string; AFilterText: string; AActive: Boolean = True; ACallBackAction: TTMSFNCFilterRuleApplyCallBackEvent = nil; AInactiveCallBackAction: TTMSFNCFilterRuleInactiveCallBackEvent = nil): TTMSFNCFilterRule; overload;

Parameters

Name Description
AName Identifier for the rule.
ASource Root component the RTTI path resolver navigates from.
AItemsPath RTTI path to the target collection or item; empty to target Source directly.
AFilterText Filter expression; empty to match all items.
AActive When True (default), the filter expression is evaluated on Apply.
ACallBackAction Optional callback fired per item while the rule is active.
AInactiveCallBackAction Optional callback fired per item when the rule is inactive.

Overload 2

Adds a rule with a raw filter-text expression and one action (match value only); returns the new rule.

function AddRule(const AName: string; ASource: TComponent; const AItemsPath: string; AFilterText: string; ATargetPath: string; const AMatchValue: TTMSFNCValue; AActive: Boolean = True): TTMSFNCFilterRule; overload;

Parameters

Name Description
AName Identifier for the rule.
ASource Root component the RTTI path resolver navigates from.
AItemsPath RTTI path to the target collection or item.
AFilterText Filter expression; empty to match all items.
ATargetPath RTTI path on each item to write the value to.
AMatchValue Value written when the filter matches.
AActive When True (default), the filter expression is evaluated on Apply.

Returns

The newly added and configured rule.

Overload 3

Adds a rule with a raw filter-text expression and one action with match and no-match values; returns the new rule.

function AddRule(const AName: string; ASource: TComponent; const AItemsPath: string; AFilterText: string; ATargetPath: string; const AMatchValue: TTMSFNCValue; ANoMatchValue: TTMSFNCValue; AActive: Boolean = True): TTMSFNCFilterRule; overload;

Parameters

Name Description
AName Identifier for the rule.
ASource Root component the RTTI path resolver navigates from.
AItemsPath RTTI path to the target collection or item.
AFilterText Filter expression; empty to match all items.
ATargetPath RTTI path on each item to write the value to.
AMatchValue Value written when the filter matches.
ANoMatchValue Value written when the filter does not match.
AActive When True (default), the filter expression is evaluated on Apply.

Returns

The newly added and configured rule.

Overload 4

Adds a rule with a raw filter-text expression and one action covering match, no-match and inactive states; returns the new rule.

function AddRule(const AName: string; ASource: TComponent; const AItemsPath: string; AFilterText: string; ATargetPath: string; const AMatchValue: TTMSFNCValue; ANoMatchValue: TTMSFNCValue; AInactiveValue: TTMSFNCValue; AActive: Boolean = True): TTMSFNCFilterRule; overload;

Parameters

Name Description
AName Identifier for the rule.
ASource Root component the RTTI path resolver navigates from.
AItemsPath RTTI path to the target collection or item.
AFilterText Filter expression; empty to match all items.
ATargetPath RTTI path on each item to write the value to.
AMatchValue Value written when the filter matches.
ANoMatchValue Value written when the filter does not match.
AInactiveValue Value written when the rule is inactive.
AActive When True (default), the filter expression is evaluated on Apply.

Overload 5

Adds a rule with a single structured condition built from typed parameters; returns the new rule.

function AddRule(const AName: string; ASource: TComponent; const AItemsPath: string; const AFieldName: string; AExpressionOperator: TTMSFNCFilterBuilderExpressionOperator; const AValue: TTMSFNCValue; AActive: Boolean = True; ACallBackAction: TTMSFNCFilterRuleApplyCallBackEvent = nil; AInactiveCallBackAction: TTMSFNCFilterRuleInactiveCallBackEvent = nil): TTMSFNCFilterRule; overload;

Parameters

Name Description
AName Identifier for the rule.
ASource Root component the RTTI path resolver navigates from.
AItemsPath RTTI path to the target collection or item.
AFieldName Name of the item field to test.
AExpressionOperator Comparison operator to apply.
AValue Value to compare against.
AActive When True (default), the rule is evaluated on Apply.
ACallBackAction Optional callback fired per item while the rule is active.
AInactiveCallBackAction Optional callback fired per item when the rule is inactive.

Overload 6

Adds a rule with a single structured condition and an explicit field data type; returns the new rule.

function AddRule(const AName: string; ASource: TComponent; const AItemsPath: string; const AFieldName: string; ADataType: TTMSFNCFilterBuilderDataType; AExpressionOperator: TTMSFNCFilterBuilderExpressionOperator; const AValue: TTMSFNCValue; AActive: Boolean = True; ACallBackAction: TTMSFNCFilterRuleApplyCallBackEvent = nil; AInactiveCallBackAction: TTMSFNCFilterRuleInactiveCallBackEvent = nil): TTMSFNCFilterRule; overload;

Parameters

Name Description
AName Identifier for the rule.
ASource Root component the RTTI path resolver navigates from.
AItemsPath RTTI path to the target collection or item.
AFieldName Name of the item field to test.
ADataType Explicit data type for the field; overrides auto-detection.
AExpressionOperator Comparison operator to apply.
AValue Value to compare against.
AActive When True (default), the rule is evaluated on Apply.
ACallBackAction Optional callback fired per item while the rule is active.
AInactiveCallBackAction Optional callback fired per item when the rule is inactive.

Overload 7

Adds a rule with two structured conditions joined by a group operator; returns the new rule.

function AddRule(const AName: string; ASource: TComponent; const AItemsPath: string; const AFieldName: string; AExpressionOperator: TTMSFNCFilterBuilderExpressionOperator; const AValue: TTMSFNCValue; AGroupOperator: TTMSFNCFilterBuilderGroupOperator; const AFieldName2: string; AExpressionOperator2: TTMSFNCFilterBuilderExpressionOperator; const AValue2: TTMSFNCValue; AActive: Boolean = True; ACallBackAction: TTMSFNCFilterRuleApplyCallBackEvent = nil; AInactiveCallBackAction: TTMSFNCFilterRuleInactiveCallBackEvent = nil): TTMSFNCFilterRule; overload;

Parameters

Name Description
AName Identifier for the rule.
ASource Root component the RTTI path resolver navigates from.
AItemsPath RTTI path to the target collection or item.
AFieldName Name of the first item field to test.
AExpressionOperator Comparison operator for the first condition.
AValue Value for the first condition.
AGroupOperator Logical operator joining the two conditions (AND or OR).
AFieldName2 Name of the second item field to test.
AExpressionOperator2 Comparison operator for the second condition.
AValue2 Value for the second condition.
AActive When True (default), the rule is evaluated on Apply.
ACallBackAction Optional callback fired per item while the rule is active.
AInactiveCallBackAction Optional callback fired per item when the rule is inactive.

Overload 8

Adds a rule with two structured conditions and explicit field data types; returns the new rule.

function AddRule(const AName: string; ASource: TComponent; const AItemsPath: string; const AFieldName: string; ADataType: TTMSFNCFilterBuilderDataType; AExpressionOperator: TTMSFNCFilterBuilderExpressionOperator; const AValue: TTMSFNCValue; AGroupOperator: TTMSFNCFilterBuilderGroupOperator; const AFieldName2: string; ADataType2: TTMSFNCFilterBuilderDataType; AExpressionOperator2: TTMSFNCFilterBuilderExpressionOperator; const AValue2: TTMSFNCValue; AActive: Boolean = True; ACallBackAction: TTMSFNCFilterRuleApplyCallBackEvent = nil; AInactiveCallBackAction: TTMSFNCFilterRuleInactiveCallBackEvent = nil): TTMSFNCFilterRule; overload;

Parameters

Name Description
AName Identifier for the rule.
ASource Root component the RTTI path resolver navigates from.
AItemsPath RTTI path to the target collection or item.
AFieldName Name of the first item field to test.
ADataType Explicit data type for the first field.
AExpressionOperator Comparison operator for the first condition.
AValue Value for the first condition.
AGroupOperator Logical operator joining the two conditions.
AFieldName2 Name of the second item field to test.
ADataType2 Explicit data type for the second field.
AExpressionOperator2 Comparison operator for the second condition.
AValue2 Value for the second condition.
AActive When True (default), the rule is evaluated on Apply.
ACallBackAction Optional callback fired per item while the rule is active.
AInactiveCallBackAction Optional callback fired per item when the rule is inactive.