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¹
How to reach it
Section titled “How to reach it”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.
Functions
Section titled “Functions”<view>()
Section titled “<view>()”<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.
| Parameter | Type | Description |
|---|---|---|
options | Partial<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()
Section titled “<view>_fullData()”<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.
| Parameter | Type | Description |
|---|---|---|
options | Partial<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.
ReportOptions
Section titled “ReportOptions”interface ReportOptions extends ReportView, PagingDefinition {}The settings of a view plus paging.
ReportOptions fields
| Field | Type | Required | Description |
|---|---|---|---|
description | string | no | Description of the view. |
filters | ReportViewFilter[] | yes | Conditions on properties of the base Entity. |
sorts | ReportViewSort[] | yes | Sort order. |
aggregations | ReportViewAggregation[] | yes | Aggregated values to compute. |
groupBy | string[] | yes | Properties to group by in aggregated mode. |
select | string[] | no | Properties to return in full-data mode. |
pageSize | number | yes | Rows per page. |
pageIndex | number | yes | Zero-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:
| Field | Result |
|---|---|
filters | The view’s filters, then yours. |
sorts | The view’s sorts, then yours. |
aggregations | The view’s aggregations, then yours. |
select | The Report’s full-data properties, the view’s select, then yours. |
groupBy | Yours only; [] if you pass none. |
pageIndex | Yours; default 0. |
pageSize | Yours; 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
ReportView
Section titled “ReportView”interface ReportViewThe settings of a view: ReportOptions without the paging fields. Its nested types:
| Type | Fields |
|---|---|
ReportViewFilter | property: string, operator: ReportViewFilterOperator, values: ReportViewFilterValue[] |
ReportViewSort | property: string, direction: 'ASC' | 'DESC' |
ReportViewAggregation | property: 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 nooutputNameis given.
Availability: Both
ReportResult
Section titled “ReportResult”interface ReportResult<T = any> extends PagedData<T> { columns: { displayName: string; property: string }[]}One page of a view’s result.
| Field | Type | Description |
|---|---|---|
list | T[] | The rows of this page. |
length | number | Total number of matching rows. |
pageIndex | number | Zero-based page number. |
pageSize | number | Rows per page. |
pageStartIndex | number | Index of the first row of this page. |
pageEndIndex | number | Index 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
Per-view types
Section titled “Per-view types”interface <ReportName>.<view>_AggregationResultRowinterface <ReportName>.<view>_FullDataResultRowtype <ReportName>.<view>_AggregationResult = ReportResult<<view>_AggregationResultRow>type <ReportName>.<view>_FullDataResult = ReportResult<<view>_FullDataResultRow>Lowgile generates these for each view:
<view>_AggregationResultRow: one property pergroupByentry of the view, with the property’s type (a relation’s id property for relations), and onenumberproperty per aggregation, named as described underReportView.<view>_FullDataResultRow: one property per property of the base Entity.
Availability: Both
Related
Section titled “Related”- Report
- Server Data Store
¹ On the client, the call is sent to the server and is subject to access control.