Filter

concerns

The Filter function returns a zero-based data field that contains a subset of a string data field based on specified filter criteria.

 

Syntax

Filter(List(), Value, Record, Compare)

Return value

Type

Description

String()

List of found list entries

Parameter

Use

Name

Type

Passing

Description

Required

List()

String()

ByVal

The items of this list will be searched for the value given in the parameter Value

Required

Value

String

ByVal

Value for the search

Optional

Record

Boolean

ByVal

See below

Optional

Compare

Long

ByVal

See below

 

With the parameter Record you can decide, if the items of the list will be returned where Value is part of one item (TRUE) or if the parts of the list of the list will be returned where Value is not part of one item (FALSE).

The parameter Compare must have one of the following values:

 

Compare

Description

0

Each item will be compared by binary.

1

Each item will be compared by text content.

 

Example

 

Dim Names() As String, NamesWithBB() As String, NamenWithoutBB() As String

 

Names := List("Abby", "Bubba", "Charlie", "Debbie", "Edgar")

 

NamesWithBB := Filter(Names, "bb", True, 1)

 

NamenWithoutBB := Filter(Names, "bb", False, 1)

 

Dim N As String

 

For Each N In NamesWithBB

   MsgBox(N)

EndFor

 

For Each N In NamesWithoutBB

   MsgBox(N)

EndFor

 

In the example, a list of names is built up and stored in the variable "Names". The Filter function now finds in the list those names that contain a double-b and creates a new list with the found names.