Skip to content

Report

A Report Business Object defines views on an Entity’s data: filters, sorts, groupings and aggregations. In code, each Report is a class under This.<ReportName> with two static methods per view: one returns the aggregated rows, the other the full data rows.

Availability: Both¹

This.<ReportName>

Reports are not grouped under a $ namespace: they are reached directly as This.<ReportName>.

Reports are typed only for server-side and client-side code. Shared code (Entity methods with availability serverAndClient or calculation) cannot reference them.

On the client, each call is forwarded to the server. For Reports, the server only checks that an End user is logged in; no AccessControl rules are evaluated.

In the signatures below, <ReportName> stands for the Report’s name and <view> for the name of one of its views.

<view>(options?: Partial<ReportOptions>): Promise<<ReportName>.<view>_AggregationResult>

Runs the view in aggregated mode: rows are grouped by the groupBy properties and carry the view’s aggregations.

ParameterTypeDescription
optionsPartial<ReportOptions>Options merged with the view’s own settings, and paging. See ReportOptions for how they are merged.

Returns: Promise<<ReportName>.<view>_AggregationResult> · Availability: Both¹

const result = await This.SalesReport.byRegion({
pageIndex: 0,
pageSize: 50,
groupBy: ['region'],
})

Note

The view’s own groupBy is not applied: only the groupBy you pass in options is used, and without it the result is a single row. Each aggregated row also carries a $count column with the number of rows in its group, which the declared row type does not include.

<view>_fullData(options?: Partial<ReportOptions>): Promise<<ReportName>.<view>_FullDataResult>

Runs the view in full-data mode: one row per matching Entity record, with the selected properties.

ParameterTypeDescription
optionsPartial<ReportOptions>Options merged with the view’s own settings, and paging. See ReportOptions for how they are merged.

Returns: Promise<<ReportName>.<view>_FullDataResult> · Availability: Both¹

Note

Each row contains only the selected properties (the Report’s full-data properties, the view’s select and the select you pass), although the declared row type lists every property of the base Entity.

interface ReportOptions extends ReportView, PagingDefinition {}

The settings of a view plus paging.

ReportOptions fields

FieldTypeRequiredDescription
descriptionstringnoDescription of the view.
filtersReportViewFilter[]yesConditions on properties of the base Entity.
sortsReportViewSort[]yesSort order.
aggregationsReportViewAggregation[]yesAggregated values to compute.
groupBystring[]yesProperties to group by in aggregated mode.
selectstring[]noProperties to return in full-data mode.
pageSizenumberyesRows per page.
pageIndexnumberyesZero-based page number.

The methods take Partial<ReportOptions>, so every field is optional when calling them.

The view methods merge the options you pass with the view’s own settings:

FieldResult
filtersThe view’s filters, then yours.
sortsThe view’s sorts, then yours.
aggregationsThe view’s aggregations, then yours.
selectThe Report’s full-data properties, the view’s select, then yours.
groupByYours only; [] if you pass none.
pageIndexYours; default 0.
pageSizeYours; default 20. 0 returns all rows.

Note

Only filters with the operator eq are applied; filters with any other operator are ignored. A filter with several values matches records equal to any of them. Only the last sort is applied, and in aggregated mode, sorts on properties that are not in the result are dropped.

Availability: Both

interface ReportView

The settings of a view: ReportOptions without the paging fields. Its nested types:

TypeFields
ReportViewFilterproperty: string, operator: ReportViewFilterOperator, values: ReportViewFilterValue[]
ReportViewSortproperty: string, direction: 'ASC' | 'DESC'
ReportViewAggregationproperty: string, operator: ReportViewAggregationOperator, outputName?: string
  • ReportViewFilterOperator: 'eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'like', 'not like', 'in', 'not in', 'between', 'not between', 'is null', 'is not null'.
  • ReportViewFilterValue: string, number, boolean, Date, or an array of one of these.
  • ReportViewAggregationOperator: 'sum', 'avg', 'min', 'max', 'count', 'distinct' (counts distinct values).
  • An aggregation’s result column is named outputName, or <property>_<operator> when no outputName is given.

Availability: Both

interface ReportResult<T = any> extends PagedData<T> {
columns: { displayName: string; property: string }[]
}

One page of a view’s result.

FieldTypeDescription
listT[]The rows of this page.
lengthnumberTotal number of matching rows.
pageIndexnumberZero-based page number.
pageSizenumberRows per page.
pageStartIndexnumberIndex of the first row of this page.
pageEndIndexnumberIndex of the last row of this page.
columns{ displayName: string; property: string }[]The result’s columns, with the row property and a display name for each.

Availability: Both

interface <ReportName>.<view>_AggregationResultRow
interface <ReportName>.<view>_FullDataResultRow
type <ReportName>.<view>_AggregationResult = ReportResult<<view>_AggregationResultRow>
type <ReportName>.<view>_FullDataResult = ReportResult<<view>_FullDataResultRow>

Lowgile generates these for each view:

  • <view>_AggregationResultRow: one property per groupBy entry of the view, with the property’s type (a relation’s id property for relations), and one number property per aggregation, named as described under ReportView.
  • <view>_FullDataResultRow: one property per property of the base Entity.

Availability: Both

¹ On the client, the call is sent to the server and is subject to access control.