# 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[], forceEscape?: boolean): void

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

  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.

  - ##### Default value forceEscape: boolean = false

  #### Returns void

### addFieldNotEqualExpression

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

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

  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.

  - ##### Default value forceEscape: boolean = false

  #### Returns void

### build

- build(exp?: string): string

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

  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 :103

  #### Returns string[]

  array containing the differents parts of the expression

### isEmpty

- isEmpty(): boolean

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

  Checks if the builder is currently empty.

  #### Returns boolean

### remove

- remove(expression: string): void

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

  Removes an expression from the builder.

  #### Parameters

  - ##### expression: string

  #### Returns void

### Static merge

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

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

  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 :126

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

  #### Parameters

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

    Builders that should be merged.

  #### Returns ExpressionBuilder

### Hierarchy

- ExpressionBuilder