Previous Topic: EXPLODEDN Function--Convert LDAP DN to Set

Next Topic: FIND Function--Return Position in String

FILTER Function--Test Set Elements

The FILTER function compares each element in the specified set to the specified pattern and returns a new set containing only the elements that match the pattern. If the optional NOT operator is included, the FILTER function returns a new set containing only the elements that do not match the pattern.

Syntax

The FILTER function has the following format:

FILTER(set, [NOT ]pattern)

Parameters

The FILTER function accepts the following parameters:

set (string)

Specifies a string of elements that are separated by the caret character: 'element1^element2'. Each element is a string.

pattern (string)

Specifies a pattern of characters. A pattern can include single characters, ranges of characters, or both. A range of characters is expressed as two characters separated by a hyphen. The following are examples of valid character ranges: 0-9, a-z, and A-Z. The pattern parameter can also include characters that are reserved and have special meanings. The reserved characters are:

Character

Meaning

?

Matches any single character

*

Matches any sequence of characters, including one or none

[set]

Matches any single character in the specified set

[!set] or [^set]

Matches any single character not in the specified set

\

Treats any reserved character as a regular character, such as \*

NOT (operator)

(Optional) If the NOT operator is included, the function returns a new set containing only the elements that do not match the pattern.

Return Value

The FILTER function returns a string of elements separated by the caret character: 'element1^element2'. Each element is a string.

Example

Return_value=FILTER('Faith^Earl^Emilie^Fred', 'E*')
Return_value='Earl^Emilie'

Return_value=FILTER('Faith^Earl^Emilie^Fred', NOT 'E*')
Return_value='Faith^Fred'

More information:

COUNT Function--Count the Elements in a Set

ENUMERATE Function--Test Set Elements

SORT Function--Sort a Set


Copyright © 2010 CA. All rights reserved. Email CA about this topic