Query class

Represents Query.

Index

Constructors

Public Properties

Public Methods

Protected Methods

Constructors


constructor

The default constructor. ⊕ new Query(model?: DataModel,data?: QueryData,options?: QueryOptions): Query

Parameters:


Public Properties


attributeExprTag

The attributec class name (Tag).

● attributeExprTag: ExprTag


clientListRequestHandler

● clientListRequestHandler: any


extraData

Contains user-defined extra data for current query.

● extraData: any


isNewbie

● isNewbie: boolean = true


model

The Data Model associated with this query.

● model: DataModel


serverListRequestHandler

● serverListRequestHandler: any


timezoneOffset

Current timezone offset (it's sent to the server for proper date/time values processing).

● timezoneOffset: number


Public Methods


addChangedCallback

Add changed callback

▸ addChangedCallback(callback: (event: EqEvent) => void): string

Parameters:

  • callback: (event: EqEvent) => void - The callback ID.

Returns string


addColumn

Adds a new column with specified parameters

▸ addColumn(descriptor: ColumnDescriptor,author?: string): Column

Parameters:

  • descriptor: ColumnDescriptor
  • author: string, Optional - The author of this operation. This parameter is used in EasyQuery widgets only to indicate which of the initiates the change.

Returns Column

Example:


query.addColumn({
    attributeId: 'Customers.CompanyName',
    sortIndex: SortDirection.Ascending
}});


addColumnObj

Adds a new column with specified index.

▸ addColumnObj(column: Column | Column[],index: any,author: any): void

Parameters:

  • column: Column | Column[] - The column or array of columns
  • index: any - The index of new column
  • author: any - The author.

Returns void

Example:


const column = new Column();
column.caption = "Company name";

query.addColumn(column, 1)


addConditionGroup

Adds a condition group - a group of simple conditions (predicates) linked by AND or OR

▸ addConditionGroup(descriptor: ConditionGroupDescriptor,addChildCondition?: boolean): Condition

Parameters:

  • descriptor: ConditionGroupDescriptor - The descriptor of the new condition group.
  • addChildCondition: boolean, Default value = true

Returns Condition - The new search condition.


addProcessCallback

Add process callback

▸ addProcessCallback(callback: (event: EqEvent) => void): string

Parameters:

  • callback: (event: EqEvent) => void - The callback.

Returns string


addSimpleCondition

Adds a new simple condition (a predicate)

▸ addSimpleCondition(descriptor: SimpleConditionDescriptor): Condition

Parameters:

Returns Condition - The new condition.


changeColumnType

Changes column to Aggregate function, custom expression or simple column.

▸ changeColumnType(column: Column,tag: ExprTag,args?: any): void

Parameters:

  • column: Column - The column to change.
  • tag: ExprTag - New column expression tag.
  • args: any, Optional - The arguments (Contains aggregate function id)

Returns void


clear

Clears query (all conditions and columns).

▸ clear(): void

Returns void


clearColumns

Clears all columns in query

▸ clearColumns(): void

Returns void


clearConditions

Clears all conditions in query.

▸ clearConditions(): void

Returns void


createColumn

▸ createColumn(): Column

Returns Column


createCondition

▸ createCondition(tag?: CondTag): Condition

Parameters:

  • tag: CondTag, Default value = CondTag.Simple

Returns Condition


fireChangedEvent

Fires change event.

▸ fireChangedEvent(data?: QueryChangeEventData,postpone?: number,wasModified?: boolean): void

Parameters:

  • data: QueryChangeEventData, Optional - The data.

  • postpone: number, Default value = 0 - The postpone.

  • wasModified: boolean, Default value = true

Returns void


fireColumnsChangedEvent

▸ fireColumnsChangedEvent(action?: QueryChangeAction,column?: Column | Column[]): void

Parameters:

Returns void


fireConditionsChangedEvent

▸ fireConditionsChangedEvent(action?: QueryChangeAction,condition?: Condition | Condition[]): void

Parameters:

Returns void


fireProcessEvent

Fires process event.

▸ fireProcessEvent(data: any): void

Parameters:

  • data: any - The data.

Returns void


getColumnSortIndex

Gets Colummn sorting index.

▸ getColumnSortIndex(col: Column): number

Parameters:

Returns number


getColumns

Get array of columns.

▸ getColumns(): Column[]

Returns Column[]


getConditionsText

Retruns conditions text

▸ getConditionsText(): string

Returns string


getDescription

Gets description of the query.

▸ getDescription(): string

Returns string


getId

Gets query ID.

▸ getId(): string

Returns string - The ID>


getModel

Gets DataModel object associated with this query.

▸ getModel(): DataModel

Returns DataModel


getName

Gets name of the query.

▸ getName(): string

Returns string


getOneValueForAttr

Gets one value for the attribute

▸ getOneValueForAttr(attrId: string): string

Parameters:

  • attrId: string - The attribute ID.

Returns string


getRootCondition

Gets root predicate

▸ getRootCondition(): Condition

Returns Condition


getSortedColumns

Gets array of columns used in sorting

▸ getSortedColumns(): Column[]

Returns Column[]


isEmptyColumns

Checks wether query does not contains any column.

▸ isEmptyColumns(): boolean

Returns boolean


isEmptyConditions

Checks wether query does not contains any condtion.

▸ isEmptyConditions(): boolean

Returns boolean


isEx

▸ isEx(): boolean

Returns boolean


isModified

▸ isModified(): boolean

Returns boolean


loadFromData

Loads query from data representation.

▸ loadFromData(data: QueryData,changeStatus?: boolean): void

Parameters:

  • data: QueryData
  • changeStatus: boolean, Default value = true

Returns void


loadFromDataOrJson

Sets data to the query.

▸ loadFromDataOrJson(data: QueryData | string,changeStatus?: boolean): void

Parameters:

  • data: QueryData | string - JSON representation object or JSON string
  • changeStatus: boolean, Default value = true - Indicate whether we should change the "isModified" status (by default == true)

Returns void


loadFromJson

Loads query from JSON.

▸ loadFromJson(json: string,changeStatus?: boolean): void

Parameters:

  • json: string - The JSON string.
  • changeStatus: boolean, Default value = true

Returns void


loadModelData

Loads data model.

▸ loadModelData(model: ModelPlainData | string): void

Parameters:

  • model: ModelPlainData | string - JSON representation object or JSON string.

Returns void


moveColumn

Moves the column with specified index to another position.

▸ moveColumn(index1: number,index2: number): void

Parameters:

  • index1: number - The index of the column that should be moved.
  • index2: number - The index of the position the column should be moved to

Returns void


regenerateId

Regenerates current query ID.

▸ regenerateId(): void

Returns void


removeChangedCallback

Remove changed callback

▸ removeChangedCallback(callbackId: string): void

Parameters:

  • callbackId: string - The callback ID.

Returns void


removeColumn

Removes the column.

▸ removeColumn(column: Column,author: any): void

Parameters:

  • column: Column - The column to be removed.
  • author: any - The author

Returns void


removeColumns

Removes several columns passed as array.

▸ removeColumns(columnsToRemove: Column[],author: any): void

Parameters:

  • columnsToRemove: Column[] - The list of columns to be removed.
  • author: any - The author.

Returns void


removeProcessCallback

Remove process callback

▸ removeProcessCallback(callbackId: string): void

Parameters:

  • callbackId: string - The callback ID.

Returns void


reset

▸ reset(silent?: boolean): void

Parameters:

  • silent: boolean, Default value = true

Returns void


resetModified

▸ resetModified(): void

Returns void


runThroughConditions

Runs through condition with this callback.

▸ runThroughConditions(processCondition: (cond: Condition) => void): void

Parameters:

  • processCondition: (cond: Condition) => void - The function to process condition.

Returns void


setDefaultName

▸ setDefaultName(): string

Returns string


setDescription

Sets description of the query

▸ setDescription(description: string): void

Parameters:

  • description: string - New description.

Returns void


setId

Sets query ID.

▸ setId(id: string): void

Parameters:

  • id: string - New Query ID.

Returns void


setModel

Sets DataModel object associated with this query.

▸ setModel(model: DataModel): void

Parameters:

Returns void


setName

Sets name of the query

▸ setName(name: string): void

Parameters:

  • name: string - New name.

Returns void


toJSON

Returns JSON representation of this query.

▸ toJSON(): string

Returns string


toJSONData

Returns JSON representation of this query.

▸ toJSONData(): QueryData

Returns QueryData


validate

Validates wether the query corresponds to the model.

▸ validate(): void

Returns void


Protected Methods


createSimpleConditionObject

▸ createSimpleConditionObject(attr: EntityAttr,operator: Operator,inputValues: string | Array<string>): Condition

Parameters:

Returns Condition