GetFilter (return filter expression)

Top  Previous  Next

 

GetFilter

The GetFilter method returns a filter expression. The GetFilter method builds the expression from values supplied by the AddItem, Ask, and SetLimit methods.

Implementation:

The returned filter expression is up to 5000 characters long.

The GetFilter method generates filter expressions using the search values set by the Ask method, the SetLimit method, or both.

 

By default, the Ask method only sets the equal to value; it does not set lower and upper values.

The generated filter expression searches for values greater than lower, less than upper, and equal to equal. For string fields, the GetFilter method applies the following special meanings to these special search characters:

Symbol

Position

Filter Effect

^

prefix

caseless (case insensitive) search

*

prefix

contains search

*

suffix

begins with search

=

prefix

inclusive search

>

prefix

exclusive search--greater than

<

prefix

exclusive search--less than

For example:

lower

upper

equal

query searches for

fred

 

 

values > fred

 

fred

 

values < fred

 

 

fred

values = fred

=fred

 

 

values >= fred

 

=fred

 

values <= fred

 

 

>fred

values >= fred

fred

fred

 

values >= fred

fred

george

george

values <= george AND values > fred

 

 

d*

values beginning with d (e.g., dog, david)

 

 

*d

values containing d (e.g., dog, cod)

 

 

^d

values d and D

 

 

^d*

values beginning with d or D (e.g., dog, David)

 

 

^*d

values containing d or D (e.g., dog, cod, coD)

Return Data Type:     STRING

Example:

MyBrowseClass.TakeLocate PROCEDURE

CurSort  USHORT,AUTO

I        USHORT,AUTO

CODE

IF ~SELF.Query&=NULL AND SELF.Query.Ask()    !get query input from end user

 CurSort = POINTER(SELF.Sort)                !save current sort order

 LOOP I = 1 TO RECORDS(SELF.Sort)

  PARENT.SetSort(I)                          !step thru each sort order

  SELF.SetFilter(SELF.Query.GetFilter(),'9-QBE') !get filter expression from Query

 END                                         ! and give it to Browse object

 PARENT.SetSort(CurSort)                     !restore current sort order

 SELF.ResetSort(1)                           !apply the filter expression

END

See Also:     AddItem, Ask, SetLimit