# Class ExpressionBuilder

An `ExpressionBuilder` that is mostly used by the QueryBuilder.
It is used to build a single query expression.
It allows combining multiple expression parts into a single string and provides utilities to generate common expression parts.

## Index

### Methods

- add
- addFieldExpression
- addFieldNotEqualExpression
- build
- fromExpressionBuilder
- getParts
- isEmpty
- remove
- merge
- mergeUsingOr

## Methods

### add

- add(expression: string): void

- - Defined in ui/Base/ExpressionBuilder.ts :18

  Add a new part to the expression.

  #### Parameters

  - ##### expression: string

  #### Returns void

### addFieldExpression

- addFieldExpression(field: string, operator: string, values: string[]): void

- - Defined in ui/Base/ExpressionBuilder.ts :38

  Add a new part to the expression, but specific for field values
  eg @field=(value1,value2,value3).

  #### Parameters

  - ##### field: string

    The field for which to create an expression (e.g.: @foo).

  - ##### operator: string

    The operator to use e.g.: = (equal) == (strict equal) <> (not equal).

  - ##### values: string[]

    The values to put in the expression.

  #### Returns void

### addFieldNotEqualExpression

- addFieldNotEqualExpression(field: string, values: string[]): void

- - Defined in ui/Base/ExpressionBuilder.ts :53

  Add a new part to the expression, but specific for field values
  eg : NOT @field==(value1, value2, value3).

  #### Parameters

  - ##### field: string

    The field for which to create an expression (e.g.: @foo)

  - ##### values: string[]

    The values to put in the expression.

  #### Returns void

### build

- build(exp?: string): string

- - Defined in ui/Base/ExpressionBuilder.ts :86

  Builds the expression string by combining all the parts together.

  #### Parameters

  - ##### Default value exp: string = " "

    expression to join the different parts, default to a space.

  #### Returns string

### fromExpressionBuilder

- fromExpressionBuilder(expression: ExpressionBuilder): void

- - Defined in ui/Base/ExpressionBuilder.ts :27

  Take another `ExpressionBuilder`, and copy it.

  #### Parameters

  - ##### expression: ExpressionBuilder

  #### Returns void

### getParts

- getParts(): string[]

- - Defined in ui/Base/ExpressionBuilder.ts :101

  #### Returns string[]

  array containing the differents parts of the expression

### isEmpty

- isEmpty(): boolean

- - Defined in ui/Base/ExpressionBuilder.ts :77

  Checks if the builder is currently empty.

  #### Returns boolean

### remove

- remove(expression: string): void

- - Defined in ui/Base/ExpressionBuilder.ts :65

  Removes an expression from the builder.

  #### Parameters

  - ##### expression: string

  #### Returns void

### Static merge

- merge(...builders: ExpressionBuilder[]): ExpressionBuilder

- - Defined in ui/Base/ExpressionBuilder.ts :110

  Merges several `ExpressionBuilder` together.

  #### Parameters

  - ##### Rest ...builders: ExpressionBuilder[]

    Builders that should be merged.

  #### Returns ExpressionBuilder

### Static mergeUsingOr

- mergeUsingOr(...builders: ExpressionBuilder[]): ExpressionBuilder

- - Defined in ui/Base/ExpressionBuilder.ts :124

  Merges several `ExpressionBuilder` together, using the OR operator.

  #### Parameters

  - ##### Rest ...builders: ExpressionBuilder[]

    Builders that should be merged.

  #### Returns ExpressionBuilder

### Hierarchy

- ExpressionBuilder