Skip to main content
Version: 8.2

Add columns to the query

Level: intermediate
note

The functionality is relevant to Classic UI.

Column from the root schema

Example

Add the column from the root schema to the query column collection.

Example that adds the column from the root schema to the query column collection
var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
rootSchemaName: "Activity"
});
esq.addColumn("DurationInMinutes", "ActivityDuration");

Aggregate column

Example 1

Add the aggregate column to the query column collection. The column must have the SUM aggregation type that applies to all table records.

Example that adds the aggregate column to the query column collection
var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
rootSchemaName: "Activity"
});
esq.addAggregationSchemaColumn("DurationInMinutes", Terrasoft.AggregationType.SUM, "ActivitiesDuration", Terrasoft.AggregationEvalType.ALL);
Example 2

Add the aggregate column to the query column collection. The column must have the COUNT aggregation type that applies to unique table records.

Example that adds the aggregate column to the query column collection
var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
rootSchemaName: "Activity"
});
esq.addAggregationSchemaColumn("DurationInMinutes", Terrasoft.AggregationType.COUNT, "UniqueActivitiesCount", Terrasoft.AggregationEvalType.DISTINCT);

Parameter column

Example

Add the parameter column with TEXT data type to the query column collection.

Example that adds the parameter column to the query column collection
var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
rootSchemaName: "Activity"
});
esq.addParameterColumn("DurationInMinutes", Terrasoft.DataValueType.TEXT, "DurationColumnName");

Function column

Example 1

Add the function column with LENGTH (value size, in bytes) data type to the query column collection.

Example that adds the function column to the query column collection
var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
rootSchemaName: "Activity"
});
esq.addFunctionColumn("Photo.Data", Terrasoft.FunctionType.LENGTH, "PhotoLength");
Example 2

Add the function column with DATE_PART (date part) data type to the query column collection. Use the day of the week as the value.

Example that adds the function column to the query column collection
var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
rootSchemaName: "Activity"
});
esq.addDatePartFunctionColumn("StartDate", Terrasoft.DatePartType.WEEK_DAY, "StartDay");
Example 3

Add the function column to the query column collection. The column must have the MACROS type that does not need to be parameterized: PRIMARY_DISPLAY_COLUMN (primary column for display).

Example that adds the function column to the query column collection
var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
rootSchemaName: "Activity"
});
esq.addMacrosColumn(Terrasoft.QueryMacrosType.PRIMARY_DISPLAY_COLUMN, "PrimaryDisplayColumnValue");