Skip to content

Class: FilterBuilder

The FilterBuilder is an API for building OData Filter options.

Hierarchy

Summary

Constructors

Properties

Class Properties

Currently none in this class.

Inherited Properties

Accessors

Class Accessors

Inherited Accessors

Methods

Class Methods

Inherited Methods

Constructors

Constructor

+ new FilterBuilder(context: IContext, ...terms: FilterBuilder[] | string[]): FilterBuilder

Overrides QueryOptionBuilder.constructor

Parameters:

Name Type
context IContext
terms FilterBuilder[] | string[]

Returns: FilterBuilder

Accessors

terms

Get Signature

getter

Returns

IFilterTerm[]

Methods

and

and(...terms: string[] | QueryOptionBuilder[]): this

The OData and operator is added to the filter option by invoking the FilterBuilder and API.

Parameters:

Name Type Description
terms string[] | QueryOptionBuilder[] a comma-separated list of FilterBuilder or string.

Returns: this

return a FilterBuilder instance for chaining


build

build(): Promise<any>

Asynchronously build the filter based on all added FilterItems

Overrides QueryOptionBuilder.build

Returns: Promise<any>

return a Promise wirth filter string


Protected composeFilterString

composeFilterString(sourceData: any, forDebugging?: boolean = false): string

Overrides QueryOptionBuilder.composeFilterString

Parameters:

Name Type
sourceData any
forDebugging? boolean = false

Returns: string


Protected createFilterTerm

createFilterTerm(term: any): string

Create the filter string for a specific FilterItem

Parameters:

Name Type Description
term any the filter item

Returns: string

return a filter string


equal

equal(property: string, rhs: any): FilterBuilder

The OData eq operator is added to the filter option by invoking the FilterBuilder equal API.

Parameters:

Name Type Description
property string the property name
rhs any the right hand side of 'eq' operator (value)

Returns: FilterBuilder

return a FilterBuilder instance for chaining


greaterThan

greaterThan(property: string, rhs: any): this

The OData gt operator is added to the filter option by invoking the FilterBuilder greaterThan API.

Parameters:

Name Type Description
property string the property name
rhs any the right hand side of 'gt' operator (value)

Returns: this

return a FilterBuilder instance for chaining


lessThan

lessThan(property: string, rhs: any): this

The OData lt operator is added to the filter option by invoking the FilterBuilder greaterThan API.

Parameters:

Name Type Description
property string the property name
rhs any the right hand side of 'lt' operator (value)

Returns: this

return a FilterBuilder instance for chaining


lessThanOrEqual

lessThanOrEqual(property: string, rhs: any): this

The OData le operator is added to the filter option by invoking the FilterBuilder greaterThan API.

Parameters:

Name Type Description
property string the property name
rhs any the right hand side of 'le' operator (value)

Returns: this

return a FilterBuilder instance for chaining


not

not(...terms: FilterBuilder[] | string[]): this

The OData not operator is added to the filter option by invoking the FilterBuilder and API.

Parameters:

Name Type Description
terms FilterBuilder[] | string[] a comma-separated list of FilterBuilder or string.

Returns: this

return a FilterBuilder instance for chaining


notEqual

notEqual(property: string, rhs: any): FilterBuilder

The OData ne operator is added to the filter option by invoking the FilterBuilder equal API.

Parameters:

Name Type Description
property string the property name
rhs any the right hand side of 'ne' operator (value)

Returns: FilterBuilder

return a FilterBuilder instance for chaining


or

or(...terms: FilterBuilder[] | string[]): this

The OData or operator is added to the filter option by invoking the FilterBuilder and API.

Parameters:

Name Type Description
terms FilterBuilder[] | string[] a comma-separated list of FilterBuilder or string.

Returns: this

return a FilterBuilder instance for chaining