1. Home
  2. Docs
  3. Data Source Expressions
  4. Data filtering

Data filtering

Quick links:

Filter function filter only selected values from the source.

Filters should be placed after the section with the name of the Register /Catalog and before the functions that retrieve data in the data source expression (see Fig. 1)

Figure 1. Filters

You can use any number of filters in an expression. They are applied to the source data one by one, and the filter conditions are added according to the “And” rule. For example, select records with a value in the Main Store column and values ​​in the Product column of a sheet or beam.

Sales | Store (main) | Product (sheet, beam) | GroupBy (Product, Quantity, Amount)

Important! Filters always use item names, not titles. Names are indicated without quotation marks.

Filtering by Period

The Filter by Period is applied only if the source is the Register.


Period ( dateStart, dateFinish ) – selects records between the specified dates, dateStart and dateFinish are included.

For example, Period(2019-01-01T00:00:00, 2019-03-22T23:59:59) ыelects from the beginning of the day January 1, 2019, to the end of the day March 3, 2019.


Period( , dateFinish )  – select records from the beginning to the indicated dateFinish, including the dateFinish.


Period( dateStart, )  – selects records from a specified dateStart, including dateStart, to the end.


Period( , Now ) or Period( Now , ) – selects until the current point in time or from the current point in time. The current time (Now) is calculated according to the time zone set in the settings.

For example, Period ( , Now) selects all records to the current point in time.


Period(standardPeriodName)  – selects records by “standard period”.

Available standard periods:

  • ThisDay
  • ThisWeek
  • ThisMonth
  • ThisQuarter
  • ThisYear
  • LastDay
  • LastWeek
  • LastMonth
  • LastQuarter
  • LastYear
  • NextDay
  • NextWeek
  • NextMonth
  • NextQuarter
  • NextYear

For example, Period (ThisYear) selects for the current year. Period (ThisMonth) selects for the current month.


Period ( date, periodType ) – selects records for the periodType in which the given date is included.

Available periodType:

  • Day
  • Month
  • Quarter
  • Year

For example, Period (2019-03-22, Month) selects for March 2019.


Note. When specifying specific date values, use the ISO format. YYYY-MM-DDThh:mm:ss

Filtering by Direction

Direction (Income) selects records with the direction Income.
Direction (Expense) selects records with a direction of Expense.

Filtering by operation type

Selects records creating by one type of operation.

Template (name1, name2, …, nameN), where name1..N are the names of the operation templates.

Template (id1, id2, …, idN), where id1 … idN are identifiers of operation templates.

Filtering by operation

Selects records creating by a specific operation.

Registrator (id1, id2, …, idN) – where id1 … idN – identifiers of operations.

Example:

Charter | NOT Registrator($h.uid) | Operation_name (checkin) | GroupBy (partner, operation_name, check_flag )

Filtering by Catalog

It is used for Registers and Catalogs.

Catalog.Name (itemName1, itemName2, …, itemNameN), where CatalogName is the name of the column in the Register or fields in the Catalog, itemName1 … itemNameN are the names of the items of the Catalog for which selection should be done.

If there is a field of type Catalog in the Register / Catalog, then a filter can be applied to the values ​​of this field.

For example, if the Store column exists in the Register, the Store (main) filter function can be used in the data source. Filters take the names or identifiers of items as arguments.

For example, Inventory | Warehouse (main, reserve) | GroupBy (Product, Quantity, Amount) – selects only those records in which the value in the Warehouse column is the main or reserve.

NOT prefix

Adding NOT to the filter means, that is, all other values not specified in the filter parameters are selected.

For example, Inventory | NOT Warehouse ( reserve ) | GroupBy (Product, Quantity, Amount) – selects only those records in which the value in the Warehouse column is not equal to the reserve.