combine_filters Function

Syntax

C combine_filters(C filter1 ,C filter2 [,C AndOr [,L flagSQLSyntax ]])

Arguments

filter1Character

First filter to combine.

filter2Character

Second filter to combine.

AndOrCharacter

Default = "AND". The operator used to combine the filters. If blank, uses "AND". Can be "AND" or "OR". Specify "AND" to use the AND operator and "OR" to use the OR operator.

flagSQLSyntaxLogical

Default = .f.. If .t., uses SQL syntax (AND, OR). Otherwise, uses Xbasic (.AND., .OR.).

Returns

resultCharacter

Returns a new filter expression that combines the two specified filters.

Description

Combine two filter expressions into a single filter expression.

Example

dim fil1 as C
dim fil2 as C
fil1 = "customer->lastname > 'A'"
fil2 = "customer->bill_state_region > 'MA'"

? combine_filters(fil1, fil2)
= "(customer->lastname > 'A') .AND. (customer->bill_state_region > 'MA')"

? combine_filters(fil1, fil2,"and")
= "(customer->lastname > 'A') .AND. (customer->bill_state_region > 'MA')"

? combine_filters(fil1, fil2,"or")
= "(customer->lastname > 'A') .OR. (customer->bill_state_region > 'MA')"

? combine_filters(fil1, fil2,"")
= "(customer->lastname > 'A') .AND. (customer->bill_state_region > 'MA')"

? combine_filters(fil1, fil2,"",.t.)
= "(customer->lastname > 'A') AND (customer->bill_state_region > 'MA')"

? combine_filters(fil1, fil2,"or",.t.)
= "(customer->lastname > 'A') OR (customer->bill_state_region > 'MA')"

? combine_filters(fil1, fil2,"",.f.)
= "(customer->lastname > 'A') .AND. (customer->bill_state_region > 'MA')"