• SKD representation expression. Data Composition System Expression Language (1Cv8). Array of values ​​in one cell

    In light of the upcoming release of 8.2.14, I will try to describe some new functions of the data composition system.

    Open the data layout diagram, preferably in an external report, to make editing easier.

    We add a dataset of the query type and write, either manually or using the query designer, a simple query:

    1. Set up a request in the access control system.

    2. Set up calculated fields in the access control system

    3. Configure the data layout on the settings tab

    4. Launch 1C Enterprise 8.2.14. Open the report. We form, we receive.

    Description of the new functions themselves:

    1. CurrentDate()

    Returns the system date. When composing a layout layout, in all expressions that are present in the layout, the CurrentDate() function is replaced with the value of the current date.

    2. COMPUTEEXPRESSION()

    Syntax:

    CalculateExpression(,)

    Description:

    The function is designed to evaluate an expression in the context of some grouping.

    The function takes into account the selection of groupings, but does not take into account hierarchical selections.

    The function cannot be applied to a grouping in the group selection of that grouping. For example, in selecting the Nomenclature grouping, you cannot use the expression CalculateExpression("Sum(SumTurnover)", "TotalTotal") > 1000. But such an expression can be used in hierarchical selection.

    If the end record precedes the start record, then it is considered that there are no records for calculating detailed data and calculating aggregate functions.

    When calculating interval expressions for a grand total (the Grouping parameter is set to GrandTotal), it is assumed that there are no records for calculating detailed data and calculating aggregate functions.

    Layout linker when generating a function expression CalculateExpression, if the ordering expression contains fields that cannot be used in grouping, replaces the function CalculateExpression on NULL.

    Options

    Type: Line. The expression to be evaluated.

    Type: Line. Contains the name of the grouping in the context of which the expression is to be evaluated. If an empty string is used as the grouping name, the calculation will be performed in the context of the current grouping. If the GeneralTotal string is used as the group name, the calculation will be performed in the context of the grand total. Otherwise, the calculation will be performed in the context of the parent grouping with the same name.

    For example:

    Sum(Sales.SumTurnover)/Calculate("Sum(Sales.SumTurnover)", "Total")

    In this example, the result will be the ratio of the sum by field Sales.AmountTurnover grouping records to the sum of the same field in the entire layout;

    Type: Line. The parameter can take the following values:

    · Grand total— the expression will be calculated for all grouping records.

    · Hierarchy— the expression will be evaluated for the parent hierarchical record, if there is one, and for the entire grouping, if there is no parent hierarchical record.

    · Grouping— the expression will be evaluated for the current group grouping record.

    · GroupingNonResource— when calculating a function for a group record by resources, the expression will be calculated for the first group record of the original grouping.

    When calculating a function CalculateExpression() with meaning GroupingNonResource for group records that are not grouped by resources, the function is calculated in the same way as it would be calculated if the parameter value was equal to the value Grouping.

    The data composition layout builder, when generating a data composition layout when outputting a resource field by which grouping is performed to the layout, places an expression in the layout that is calculated using the function CalculateExpression() , indicating the parameter GroupingNonResource. For other resources, the usual resource expressions are placed in the resource grouping.

    Type: Line. Indicates from which record the fragment should begin, in which aggregate expression functions should be calculated, and from which record to obtain field values ​​outside of aggregate functions. The value can be one of the following:

    · First

    · Last (Last)

    · Previous

    · Next (Next)

    · Current

    · LimitingValue(BoundaryValue) LimitingValue

    Type: Line. Indicates to which record the fragment should be continued, in which the aggregate functions of the expression should be calculated. The value can be one of the following:

    · First. It is necessary to obtain the first grouping record. After the word in brackets, you can specify an expression, the result of which will be used as an offset from the beginning of the grouping. The resulting value must be an integer greater than zero. For example, First(3) - receiving the third record from the beginning of the grouping.

    If the first record is outside the grouping, then it is considered that there are no records. For example, if there are 3 records, and you want to get First(4), then it is considered that there are no records.

    · Last (Last). You need to get the last grouping record. After the word in brackets, you can specify an expression, the result of which will be used as an offset from the end of the grouping. The resulting value must be an integer greater than zero. For example, Last(3) - receiving the third record from the end of the group.

    If the last record is outside the grouping, then it is considered that there are no records. For example, if there are 3 records, and you want to get Last(4), then it is considered that there are no records.

    · Previous. You need to get the previous grouping record. After the word in brackets, you can specify an expression, the result of which will be used as an offset back from the current grouping record. For example, Previous(2) - getting the previous from the previous record.

    If the previous record goes beyond the grouping (for example, for the second grouping record you need to get Previous(3)), then the first grouping record is obtained.

    When retrieving the previous record for a grouping total, it is considered that the first record is obtained.

    · Next (Next). You need to get the next grouping record. After the word in brackets, you can specify an expression, the result of which will be used as an offset forward from the current grouping entry. For example, Next(2) - getting next from the next record.

    If the next record goes beyond the grouping, then it is considered that there are no records. For example, if there are 3 entries and the third entry receives Next() , then it is considered that there are no entries.

    When the next record is received for the grouping total, it is considered that there is no record.

    · Current. You need to get the current record.

    When retrieving for a grouping total, the first record is obtained.

    · LimitingValue(BoundaryValue). The need to obtain a record by the specified value. After the word LimitingValue in brackets you need to indicate the expression with the value of which you want to start the fragment, the first ordering field.

    The first record whose ordering field value is greater than or equal to the specified value will be returned as the record. For example, if the Period field is used as the ordering field, and it has the values ​​01/01/2010, 02/01/2010, 03/01/2010, and you want to get LimitingValue(DateTime(2010, 1, 15)), then a record with the date 02/01/2010 will be received.

    Type: Line. Lists expressions, separated by commas, that describe the ordering rules. If not specified, then the ordering is performed in the same way as for the grouping for which the expression is evaluated. After each expression you can specify a keyword Age(for ordering in ascending order), Descending(for ordering in descending order) and Auto-order(to order reference fields by the fields by which you want to order the referenced object). Word Auto-order can be used as with the word Age, so with the word Descending.

    Type: Line. Same as parameter Sorting. Used to organize hierarchical records. If not specified, the layout builder generates the ordering according to the ordering specified in the parameter Sorting.

    Type: Line. Specifies the rule for determining the previous or next record in case there are several records with the same ordering value:

    · Separately indicates that a sequence of ordered records is used to determine the previous and next records. Default value.

    · Together indicates that the previous and next records are determined based on the values ​​of the ordering expressions.

    For example, if the resulting sequence is ordered by date:

    Date Full name Meaning
    1 January 01, 2001

    Ivanov M.

    10
    2 02 January 2001 Petrov S. 20
    3 January 03, 2001 Sidorov R. 30
    4 04 January 2001 Petrov S. 40

    Separately, That:

    § the previous entry to entry 3 will be entry 2.

    Current, Current(accordingly, parameters Start And End), then for record 2 this fragment will consist of one record 2. The expression will be equal to 20.

    If the parameter value is Together, That:

    § the previous entry to entry 3 will be entry 1.

    § if the calculation fragment is defined as Current, Current(accordingly, parameters Start And End), then for record 2 this fragment will consist of records 2 and 3. Expression CalculateExpression("Sum(Value)", Current, Current) will be equal to 50.

    When specifying a parameter value equal to Together, in parameters Start And End you cannot specify an offset for positions First, Last, Previous, Next.

    CalculateExpression("Sum(SumTurnover)", "First", "Current")

    If you want to get the grouping value in the previous line, you can use the following expression:

    CalculateExpression("Rate", "Previous")

    List new functions:

    CalculateExpressionWithGroupArray(,) -

    The function returns an array, each element of which contains the result of evaluating an expression for grouping by the specified field.

    CalculateExpressionWithGroupValueTable(,) -

    The function returns a table of values, each row of which contains the result of evaluating expressions for grouping by the specified field

    ValueFilled() - Returns True if the value is other than the default value of this type, other than NULL, other than an empty reference, other than Undefined. Boolean values ​​are checked for NULL values. Strings are checked for the absence of non-whitespace characters

    Format(, ) - Receive a formatted string of the passed value. The format string is set in accordance with the format string of the 1C:Enterprise system.

    Substring(, , ) - This function is designed to extract a substring from a string.

    Line Length() - The function is designed to determine the length of a string. Parameter is a string expression

    Line() - If an array is passed as a parameter, the function returns a string containing string representations of all array elements, separated by "; " characters. If a table of values ​​is passed as a parameter, the function returns a string containing string representations of all rows of the table of values, with the cell representations of each row separated by ";" characters, and the rows by a newline character. If an element's string representation is empty, then a string is displayed instead of its representation.

    One of the most important areas of business software is reporting. The fate of a business can depend (and not in a figurative sense!) on how easy it is to customize an existing report to the changing needs of business (and legislation) or create a new one, be it a report for the tax office or a diagram of the dependence of demand for goods on the season and other factors . A powerful and flexible reporting system that makes it easy to extract the necessary data from the system, present it in an understandable form, allowing the end user to reconfigure a standard report to see the data in a new light - this is the ideal that every business system should strive for.

    In the 1C:Enterprise platform, a mechanism called the “Data Composition System” (abbreviated as DCS) is responsible for generating reports. In this article we will try to give a brief description of the idea and architecture of the ACS mechanism and its capabilities.


    ACS is a mechanism based on a declarative description of reports. The access control system is designed for generating reports and for displaying information with a complex structure. By the way, in addition to developing reports, the ACS mechanism is also used in 1C:Enterprise in a dynamic list, a tool for displaying list information with rich functionality (displaying flat and hierarchical lists, conditional design of rows, groupings, etc.).

    A little history

    In the very first version of the 1C:Enterprise 8 platform, version 8.0, reports were made like this:
    1. One or more queries were written in the 1C query language (SQL-like language, more about it below).
    2. Code was written that transferred the results of executed queries to a spreadsheet document or chart. The code could also do work that could not be done in a query - for example, it calculated values ​​using the built-in 1C language.
    The approach is straightforward, but not the most convenient - there are minimal visual settings, everything has to be programmed “hand-to-hand”. And one of the trump cards at that time of the completely new platform “1C:Enterprise 8” was the minimization in the application solution of the amount of code that had to be written manually, in particular, through visual design. It would be logical to follow the same path in the reporting mechanism. This was done by developing a new mechanism - the Data Composition System.

    One of the ideas that formed the basis of the access control system was the flexibility and customization of reports, which was accessible to both the developer and the end user. Ideally, I would like to give the end user access to the same set of report design tools as the developer. It would be logical to create a single set of tools available to everyone. Well, since the tools require the participation of the end user, it means that the use of programming in them should be reduced to a minimum (it is best to eliminate it completely), and visual settings should be used to the maximum.

    Statement of the problem

    The task before the development team was to create a reporting system based not on an algorithmic (i.e., through writing code), but on a declarative approach to creating reports. And we believe that the problem has been successfully solved. In our experience, about 80% of the required reporting can be implemented using ACS without a single line of code (except for writing formulas for calculated fields), mostly through visual settings.
    The development of the first version of the SDS took about 5 person-years.

    Two languages

    There are two languages ​​involved in creating reports. One is a query language used to retrieve data. The second is the data composition expression language, intended for writing expressions used in various parts of the system, for example, in data composition settings, to describe expressions of user fields.

    Query language

    The query language is based on SQL and is easy to learn for those knowledgeable in SQL. Example request:

    It is easy to see analogues of sections standard for SQL queries - SELECT, FROM, GROUP BY, ORDER BY.

    At the same time, the query language contains a significant number of extensions aimed at reflecting the specifics of financial and economic problems and at minimizing the effort required to develop application solutions:

    • Accessing fields using a dot. If the fields of a table are of a reference type (they store links to objects of another table), the developer can refer to them in the text of the request through “.”, and the system does not limit the number of nesting levels of such links (for example, Customer Order. Agreement. Organization. Telephone).
    • Multidimensional and multilevel formation of results. Totals and subtotals are formed taking into account grouping and hierarchy, levels can be traversed in any order with summing up, and the correct construction of totals according to time dimensions is ensured.
    • Support for virtual tables. Virtual tables provided by the system allow you to obtain almost ready-made data for most application tasks without the need to create complex queries. Thus, a virtual table can provide data on product balances by periods at a certain point in time. At the same time, virtual tables make maximum use of the stored information, for example, previously calculated totals, etc.
    • Temporary tables. The query language allows you to use temporary tables in queries. With their help, you can improve query performance, in some cases reduce the number of blockings and make the query text easier to read.
    • Batch requests. To make working with temporary tables more convenient, the query language supports working with batch queries - thus, the creation of a temporary table and its use are placed in one query. A batch request is a sequence of requests separated by semicolons (";"). The requests in the batch are executed one after another. The result of executing a batch request, depending on the method used, will be either the result returned by the last request in the batch, or an array of results from all queries in the batch in the sequence in which the queries in the batch follow.
    • Retrieving representations of reference fields. Each object table (in which a directory or document is stored) has a virtual field - “View”. This field contains a textual representation of the object and makes the report creator's job easier. So, for a document, this field contains all the key information - the name of the document type, its number and date (for example, “Sale 000000003 from 07/06/2017 17:49:14”), saving the developer from writing a calculated field.
    • etc.
    The request mechanism automatically modifies the request taking into account the roles to which the user on whose behalf the request is executed belongs (i.e., the user will see only the data that he has the right to see) and functional options (i.e., in accordance with those configured in the application solution functionality).

    There are also special query language extensions for access control systems. Expansion is carried out using special syntactic instructions enclosed in curly braces and placed directly in the request body. Using extensions, the developer determines what operations the end user will be able to perform when customizing the report.

    For example:

    • CHOOSE. This sentence describes the fields that the user will be able to select for output. After this keyword, aliases of fields from the main query selection list that will be available for configuration are listed, separated by commas. Example: (SELECT Item, Warehouse)
    • WHERE. The fields on which the user can apply selection are described. This proposal uses table fields. The use of selection list field aliases is not allowed. Each part of the union can contain its own WHERE element. Examples: (WHERE Item.*, Warehouse), (WHERE Document.Date >= &StartDate, Document.Date<= &ДатаКонца}
    • etc.
    Example of using extensions:

    Data Composition Expression Language

    The Data Composition Expression Language is designed to write expressions used, in particular, to describe custom field expressions. SKD allows you to define custom fields in a report using either your own expressions or sets of options with conditions for their selection (analogous to CASE in SQL). Custom fields are similar to calculated fields. They can be set both in the configurator and in 1C:Enterprise mode, but the functions of common modules cannot be used in custom field expressions. Therefore, custom fields are intended for the user rather than the developer.

    Example:

    The process of creating a report on the access control system

    When creating a report, we need to create a layout that determines how the data will be displayed in the report. You can create a layout based on a data layout diagram. A data layout diagram describes the essence of the data that is provided to the report (where to get the data from and how you can control its layout). The data composition scheme is the basis on which all kinds of reports can be generated. The data composition scheme may contain:
    • request text with instructions for the data composition system;
    • description of multiple data sets;
    • detailed description of available fields;
    • describing relationships between multiple data sets;
    • description of data acquisition parameters;
    • description of field layouts and groupings;
    • etc.

    For example, you can add a query to the data composition scheme as a data set and call the query constructor, which allows you to graphically create a query of arbitrary complexity:

    The result of launching the query designer will be the query text (in the 1C:Enterprise query language). This text can be adjusted manually if necessary:

    There can be several data sets in a data layout scheme, data sets can be linked in the layout in any way, calculated fields can be added, report parameters can be specified, etc. It is worth mentioning an interesting feature of the query mechanism in 1C:Enterprise. Queries are ultimately translated into a dialect of SQL specific to the DBMS with which the application directly operates. In general, we try to use the capabilities of DBMS servers to the maximum (we are limited by the fact that we use only those capabilities that are simultaneously available in all DBMSs supported by the 1C:Enterprise platform - MS SQL, Oracle, IBM DB2, PostgreSQL). Thus, at the query level in calculated fields, we can only use those functions that are translated into SQL.

    But at the level of the data composition scheme, we can already add custom fields and use functions in them in the built-in 1C development language (including those written by us), which greatly expands the capabilities of reports. Technically, it looks like this - everything that can be translated into SQL is translated into SQL, the query is executed at the DBMS level, the query results are placed in the memory of the 1C application server and the SKD calculates for each record the values ​​of calculated fields whose formulas are written in the 1C language.


    Adding Custom Fields

    You can add an arbitrary number of tables and charts to the report:


    Report designer


    Runtime report

    Using SKD, the user can add complex selections to the report (which will be added to the request in the right places), conditional design (allowing the displayed fields to be formatted differently - with font, color, etc., depending on their values) and much more .

    The process of constructing and generating a report can be briefly described as follows:

    • The developer in design time with the help of a designer (or in runtime using code) determines the data layout scheme:
      • Text of the request/requests
      • Description of calculated fields
      • Relationships between requests (if there are several of them)
      • Report Options
      • Default Settings
      • Etc.
    • The above settings are saved in the layout
    • User opens report
      • Possibly makes additional settings (for example, changes parameter values)
      • Clicks the “Generate” button
    • User settings are applied to the data composition scheme defined by the developer.
    • An intermediate data layout layout is formed, containing instructions on where to receive data from. In particular, the queries specified in the layout are adjusted. Thus, fields that are not used in the report are removed from the request (this is done in order to minimize the amount of data received). All fields that participate in calculated field formulas are added to the query.
    • The data composition processor comes into play. The layout processor executes queries, links data sets, calculates values ​​for calculated fields and resources, and performs grouping. In a word, it makes all the calculations that were not performed at the DBMS level.
    • The data output processor launches a request for execution and displays the received data in a spreadsheet document, chart, etc.


    The process of generating a report using the ACS mechanism

    We try to minimize the amount of report data transferred from the server to the client application. When displaying data in a spreadsheet document, when opening a spreadsheet document, we transfer from the server only those lines that the user sees at the beginning of the document. As the user moves along the lines of the document, the missing data is downloaded from the server to the client.

    Custom Settings

    All ACS tools are available to both the developer and the end user. But practice has shown that the end user is often intimidated by the abundance of tool capabilities. Moreover, in most cases, the end user does not need all the power of settings - it is enough for him to have quick access to setting up one or two report parameters (for example, period and counterparty). Starting from a certain version of the platform, the report developer has the opportunity to mark which report settings are available to the user. This is done using the “Include in user settings” checkbox. Also, the report settings now have a “Display Mode” flag, which takes one of three values:
    • Quick access. The setting will be displayed directly at the top of the report window.
    • Ordinary. The setting will be available through the “Settings” button.
    • Inaccessible. The setting will not be available to the end user.


    Setting display mode in design time


    Display the setting in Quick Access mode at runtime (under the Generate button)

    Development plans

    One of our priority areas in the development of access control systems is simplifying user settings. Our experience shows that for some end users, working with user settings is still a major undertaking. We take this into account and are working in this direction. Accordingly, it will also become easier for developers to work with access control systems, because We, as before, want to provide a single tool for setting up reports for both the developer and the end user.

    1. Calculate (Eval)- is intended to evaluate an expression in the context of some grouping. The function is used for compatibility with previous versions of the platform. It is recommended to use the CalculateExpression function instead.

    Syntax:
    Calculate(Expression, Grouping, CalculationType)

    Parameters:

    • Expression(Line). Contains a calculated expression;
    • Grouping(Line). Contains the name of the grouping in the context of which the expression is to be evaluated. If an empty string is used as the grouping name, the calculation will be performed in the context of the current grouping. If the GrandTotal string is used as the group name, the calculation will be performed in the context of the grand total. Otherwise, the calculation will be performed in the context of the parent grouping with the same name.
      For example:
      Sum(Sales.SumTurnover) / Calculate("Sum(Sales.SumTurnover)", "Total").
      In this example, the result will be the ratio of the amount for the "Sales.AmountTurnover" field of the grouping record to the amount of the same field in the entire layout.
    • Calculation type(Line). If this parameter is set to "TotalTotal", the expression will be calculated for all grouping records. If the value of the parameter is "Grouping", the values ​​will be calculated for the current grouping group record.
    2. Evaluate Expression (EvalExpression) - is intended to evaluate an expression in the context of some grouping. The function takes into account the selection of groupings, but does not take into account hierarchical selections. The function cannot be applied to a grouping in the group selection of that grouping.

    Syntax:
    CalculateExpression(Expression, Grouping, CalculationType, Start, End, Sort, HierarchicalSort, ProcessingIdenticalOrderValues)

    Parameters:

    • Expression(Line). Contains a calculated expression;
    • Grouping(Line). Contains the name of the grouping in the context of which the expression is to be evaluated. If an empty string is used as the grouping name, the calculation will be performed in the context of the current grouping. If the GrandTotal string is used as the group name, the calculation will be performed in the context of the grand total. Otherwise, the calculation will be performed in the context of the parent grouping with that name;
    • Calculation type(Line). If this parameter is set to "TotalTotal", the expression will be calculated for all grouping records. If the value of the parameter is "Grouping", the values ​​will be calculated for the current grouping group record. If the parameter is set to "Non-Resource Grouping", then when calculating the function for a group record by resource, the expression will be evaluated for the first group record of the original grouping. When evaluating the CalculateExpression function with the value "GroupingNonResource" for group records that are not groupings by resource, the function is evaluated in the same way as it would be evaluated with the value of the "Grouping" parameter. The data composition layout builder, when generating a data composition layout when outputting a field - a resource by which grouping is performed, to the layout, outputs to the layout an expression calculated using the CalculateExpression function with the specified "GroupingNon-Resource" parameter. For other resources grouped by resource, normal resource expressions are returned. If the parameter is set to "Hierarchy", then the expression must be evaluated for the parent hierarchical record, if there is one, and for the entire grouping, if there is no parent hierarchical record. The layout builder, when generating an expression for the % in Hierarchy Group field, generates an expression containing the relationship of the resource expression to the CalculateExpression function for the resource expression being calculated for the current grouping with calculation type Hierarchy.
    • Start. Indicates from which record the fragment should begin, in which aggregate expression functions should be calculated, and from which record to obtain field values ​​outside of aggregate functions. A string containing one of:
      • "First" It is necessary to obtain the first grouping record. After the word in brackets, you can specify an expression, the result of which will be used as an offset from the beginning of the grouping. The resulting value must be an integer greater than zero. For example, First(3) – receiving the third record from the beginning of the grouping. If the first record is outside the grouping, then it is considered that there are no records. For example, if there are 3 records, and you want to get First(4), then it is considered that there are no records.
      • "Last" You need to get the last grouping record. After the word in brackets, you can specify an expression, the result of which will be used as an offset from the end of the grouping. The resulting value must be an integer greater than zero. For example, Last(3) – receiving the third record from the end of the group. If the last record is outside the grouping, then it is considered that there are no records. For example, if there are 3 records, and you want to get Last(4), then it is considered that there are no records.
      • "Previous" You need to get the previous grouping record. After the word in brackets, you can specify an expression, the result of which will be used as an offset back from the current grouping record. For example, Previous(2) – getting the previous from the previous record. If the previous record is outside the grouping (for example, the second grouping record requires getting Previous(3)), then the first grouping record is obtained. When receiving the previous record for the grouping total, the first record is obtained.
      • "Next" You need to get the next grouping record. After the word in brackets, you can specify an expression, the result of which will be used as an offset forward from the current grouping entry. For example, Next(2) – getting the next from the next record. If the next record goes beyond the grouping, then it is considered that there are no records. For example, if there are 3 entries and the third entry receives Next, then it is considered that there are no entries. When the next record is received for the grouping total, it is considered that there is no record.
      • "Current". You need to get the current record. When retrieving for a grouping total, the first record is obtained.
      • "BoundaryValue". The need to obtain a record by the specified value. After the word LimitingValue in parentheses, you need to indicate the expression with the value of which you want to start the fragment, the first ordering field. The first record whose ordering field value is greater than or equal to the specified value will be returned as the record. For example, if the Period field is used as the ordering field, and it has the values ​​01/01/2010, 02/01/2010, 03/01/2010, and you want to get the LimitingValue(DateTime(2010, 1, 15)), then a record with the date 02/01 will be obtained. 2010.
    • End. Indicates to which record the fragment should be continued, in which the aggregate expression should be calculated. A string containing one of:
      • "First"
      • "Last"
      • "Previous"
      • "Next"
      • "Current".
      • "BoundaryValue".
    • Sorting. A string that lists the expressions, separated by commas, in the direction of which the sequence should be ordered. If not specified, then the ordering is performed in the same way as for the grouping for which the expression is evaluated. After each expression, you can specify the keyword Ascending, for ordering in ascending order, Descending, for ordering in descending order, Auto-Ordering, for ordering the reference fields by the fields by which you want to order the object being referenced. The word Auto Order can be used with both the word Ascending and the word Descending.
    • HierarchicalSorting. Similar to sorting. Used to organize hierarchical records. If not specified, the layout compositor generates the ordering according to the ordering specified in the Sort parameter.
    • Processing Same Values ​​of Order. A string containing one of:
      • "Together" means that a sequence of ordered records is used to determine the previous and next records;
      • "Separately" means that the previous and next records are determined based on the values ​​of the ordering expressions;
      For example, if the resulting sequence is ordered by date:
      1. January 01, 2001 Ivanov M. 10
      2. January 02, 2001 Petrov S. 20
      3. January 02, 2001 Sidorov R. 30
      4. January 03, 2001 Petrov S. 40
      When using processing of identical values ​​of the order "Separately", the previous one for record 3 will be record 2, and when using "Together" - record 1. And the fragment for the current record for record 2 for "Separately" will be record 2, and for "Together" - records 2 and 3. Thus, the total for the current record for “Separately” will be 20, and for “Together” - 50. When “Together” is specified in the Start and End parameters, you cannot specify an offset for the positions “First”, “Last”, "Previous", "Next". The default value is "Separate".
    Example:
    Obtaining the ratio of the amount for the "Sales.AmountTurnover" field of a grouping record to the amount of the same field in the entire layout:
    Sum(Sales.SumTurnover) / CalculateExpression("Sum(Sales.SumTurnover)", "Total").

    This example calculates the value of the current hierarchy:
    Choice
    When Level() > 0
    Then EvaluateExpression("Reference", "Hierarchy")
    Otherwise Null
    End

    Notes:
    The function takes into account the selection of groupings, but does not take into account hierarchical selections. The function cannot be applied to a grouping in the group selection of that grouping. For example, in selecting the Nomenclature grouping, you cannot use the expression CalculateExpression("Sum(SumTurnover)", "TotalTotal") > 1000 . But such an expression can be used in hierarchical selection. If the end record precedes the start record, then it is considered that there are no records for calculating detailed data and calculating aggregate functions. When calculating interval expressions for a grand total (the Grouping parameter is set to "GrossTotal"), it is assumed that there are no records for calculating detailed data and calculating aggregate functions. When generating an expression for the CalculateExpression function, the layout compositor, if the ordering expression contains fields that cannot be used in grouping, replaces the CalculateExpression function with NULL.

    3. Evaluate Expression With Group Array (EvalExpression With Group Array) - the function returns an array, each element of which contains the result of calculating an expression for grouping by the specified field.

    Syntax:
    CalculateExpressionWithGroupArray (Expression, GroupFieldExpressions, SelectRecords, SelectGroups)

    Parameters:

    • Expression(String) - the expression to be evaluated. For example, "Amount(AmountTurnover)";
    • FieldExpressionsGroups
    • Selection of Records
    • Selection of Groupings- selection applied to group records. For example: "Amount(AmountTurnover) > &Parameter1".
    Example:
    Maximum(CalculateExpressionWithGroupArray("Amount(AmountTurnover)", "Counterparty"));


    The layout builder, when generating expressions to display a custom field whose expression contains only the CalculateArrayWithGroup function, generates the output expression in such a way that the display data and the data are ordered.
    For example, for a custom field with the expression:
    CalculateExpressionWithGroupArray("Amount(AmountTurnover)", "Counterparty")
    The layout builder will generate the following expression for output:
    ConnectRows(Array(Order(CalculateExpressionWithGroupingValueTable("View(Sum(DataSet.AmountTurnover)), Amount(DataSet.AmountTurnover)", "DataSet.Account"), "2")))

    4. Calculate Expression With GroupValueTable (EvalExpressionWithGroupValueTable) - the function returns a table of values, each element of which contains the result of calculating an expression for grouping by the specified field.

    Syntax:
    CalculateExpressionWithGroupValueTable(Expression, GroupFieldExpressions, SelectRecords, SelectGroups)

    Parameters:

    • Expression(String) - the expression to be evaluated. A line can contain multiple expressions separated by commas. After each expression there may be an optional keyword AS and the name of the value table column. For example: "Counterparty, Amount (AmountTurnover) As Sales Volume."
    • FieldExpressionsGroups- expressions of grouping fields, separated by commas. For example, "Counterparty, Party";
    • Selection of Records- an expression applied to detail records. For example, "Deletion Flag = False." If this parameter uses an aggregate function, an error will occur when composing the data;
    • Selection of Groupings- selection applied to group records. For example: "Amount(AmountTurnover) > &Parameter1".
    Example:
    CalculateExpressionWithGroupValueTable("Account AS Counterparty, Amount(AmountTurnover) AS SalesVolume", "Account")

    The result of this function will be a table of values ​​with columns Counterparty and Sales Volume, which will contain counterparties with their sales volumes.
    The layout builder, when generating a layout, converts function parameters into terms of data layout layout fields. For example, the Account field will be converted to DataSet.Account.
    For example, a custom field with the expression:
    CalculateExpressionWithGroupValueTable("Account, Amount(AmountTurnover)", "Account")
    The layout builder will generate the following expression for output:
    ConnectRows(GetPart(Order(CalculateExpressionWithGroupingValueTable("DataSet.Account, DataSet.AccountRepresentation, Sum(DataSet.AmountTurnover), View(DataSet.AmountTurnover), DataSet.OrderingField", "DataSet.Account"), "5, 1, 3" ), "2, 4"))

    5. Level - the function is designed to obtain the current recording level.

    Syntax:
    Level()

    Example:
    Level()

    6. SequenceNumber - get the next serial number.

    Syntax:
    NumberByOrder()

    Example:
    NumberByOrder()

    7. SequenceNumberInGrouping - returns the next sequence number in the current grouping.

    Example:
    NumberByOrderInGroup()

    8. Format - get a formatted string of the passed value.

    Syntax:
    Format(Value, FormatString)

    Parameters:

    • Meaning- the expression that needs to be formatted;
    • FormatString- the format string is set in accordance with the 1C:Enterprise format string.
    Example:
    Format(Invoices.Doc Amount, "NPV=2")

    9. BeginOfPeriod

    Syntax:
    StartPeriod(Date, PeriodType)

    Parameters:

    • Date(Date). Specified date;
    • Period Type
    Example:
    StartPeriod(DateTime(2002, 10, 12, 10, 15, 34), "Month")
    Result: 10/01/2002 0:00:00

    10. EndOfPeriod - the function is designed to select a specific date from a given date.

    Syntax:
    EndPeriod(Date, PeriodType)

    Parameters:

    • Date(Date). Specified date;
    • Period Type(Line). Contains one of the following values: Minute; Hour; Day; Week; Month; Quarter; Year; Decade; Half year.
    Example:
    EndPeriod(DateTime(2002, 10, 12, 10, 15, 34), "Week")
    Result: 10/13/2002 23:59:59

    11. AddKDate (DateAdd) - the function is designed to add a certain value to the date.

    Syntax:
    AddToDate(Expression, IncrementType, Magnitude)

    Parameters:

    • Expression(Date). Original date;
    • TypeMagnification(Line). Contains one of the following values: Minute; Hour; Day; Week; Month; Quarter; Year; Decade; Half year.
    • Magnitude(Number). By how much the date needs to be increased, the fractional part is ignored.
    Example:
    AddToDate(DateTime(2002, 10, 12, 10, 15, 34), "Month", 1)
    Result: 11/12/2002 10:15:34

    12. DateDifference - the function is designed to get the difference between two dates.

    Syntax:
    DifferenceDate(Expression1, Expression2, DifferenceType)

    Parameters:

    • Expression1(Date). Subtracted date;
    • Expression2(Date). Original date;
    • TypeDifference(Line). Contains one of the values: Second; Minute; Hour; Day; Month; Quarter; Year.
    Example:
    DATEDIFFERENCE(DATETIME(2002, 10, 12, 10, 15, 34),
    DATETIME(2002, 10, 14, 9, 18, 06), "DAY")
    Result: 2

    13. Substring - this function is designed to extract a substring from a string.

    Syntax:
    Substring(String, Position, Length)

    Parameters:

    • Line(Line). The string from which the substring is extracted;
    • Position(Number). The position of the character from which the substring to be extracted from the string begins;
    • Length(Number). Length of the allocated substring.
    Example:
    SUBSTRING(Accounts.Address, 1, 4)

    14. StringLength - the function is designed to determine the length of a string.

    Syntax:
    StringLength(String)

    Parameter :

    • Line(Line). A string whose length is specified.
    Example:
    Line(Counterparties.Address)

    15. Year- this function is designed to extract the year from a Date type value.

    Syntax:
    Year(Date)

    Parameter :

    • Date(Date). The date by which the year is determined.
    Example:
    YEAR(Expense.Date)

    16. Quarter - this function is designed to extract the quarter number from a Date type value. The quarter number normally ranges from 1 to 4.

    Syntax:
    Quarter(Date)

    Parameter :

    • Date(Date). The date by which the quarter is determined
    Example:
    QUARTER(Expense.Date)

    17. Month - this function is designed to extract the month number from a Date type value. The month number normally ranges from 1 to 12.

    Syntax:
    Month(Date)

    Parameter :

    • Date(Date). The date by which the month is determined.
    Example:
    MONTH(Expense.Date)

    18. Day of the Year (DayOfYear) - this function is designed to obtain the day of the year from a Date type value. The day of the year normally ranges from 1 to 365 (366).

    Syntax:
    Day of the Year(Date)

    Parameter :

    • Date(Date). The date by which the day of the year is determined.
    Example:
    DAYYEAR(Expense.Date)

    19. Day- this function is designed to obtain the day of the month from a Date type value. The day of the month normally ranges from 1 to 31.

    Syntax:
    Day(Date)

    Parameter :

    • Date(Date). The date by which the day of the month is determined.
    Example:
    DAY(Expense.Date)

    20. Week - this function is designed to obtain the week number of the year from a Date type value. The weeks of the year are numbered starting from 1.

    Syntax:
    Week(Date)

    Parameter :

    • Date(Date). The date by which week numbers are determined.
    Example:
    WEEK(Expense.Date)

    21. WeekDay - this function is designed to obtain the day of the week from a Date type value. The normal day of the week ranges from 1 (Monday) to 7 (Sunday).

    Syntax:
    Day of the Week(Date)

    Parameter :

    • Date(Date). The date by which the day of the week is determined.
    Example:
    DAY OF THE WEEK(Expense.Date)

    22. Hour- this function is designed to obtain the hour of day from a Date type value. The hour of the day ranges from 0 to 23.

    Syntax:
    Hour(Date)

    Parameter :

    • Date(Date). The date by which the hour of the day is determined.
    Example:
    HOUR(Expense.Date)

    23. Minute - this function is designed to obtain the minute of the hour from a Date type value. The minute of the hour ranges from 0 to 59.

    Syntax:
    Minute(Date)

    Parameter :

    • Date(Date). The date by which the minute of the hour is determined.
    Example:
    MINUTE(Expense.Date)

    24. Second - this function is designed to obtain the second of a minute from a Date type value. The second of a minute ranges from 0 to 59.

    Syntax:
    Second(Date)

    Parameter :

    • Date(Date). The date by which the seconds of the minute are determined.
    Example:
    SECOND(Exp.Date)

    25. Cast - this function is designed to extract a type from an expression that may contain a compound type. If the expression contains a type other than the required type, NULL will be returned.

    Syntax:
    Express(Expression, TypeIndication)

    Parameters:

    • Expression- the expression to be converted;
    • Type Indication(Line). Contains a type string. For example, "Number", "String", etc. In addition to primitive types, this line may contain the name of the table. In this case, an attempt will be made to express a reference to the specified table.
    Example:
    Express(Data.Props1, "Number(10,3)")

    26. IsNull (IsNull) - this function returns the value of the second parameter if the value of the first parameter is NULL. Otherwise, the value of the first parameter will be returned.

    Syntax:
    IsNull(Expression1, Expression2)

    Parameters:

    • Expression1- value to be checked;
    • Expression2- return value if Expression1 is NULL.
    Example:
    YesNULL(Amount(Sales.AmountTurnover), 0)

    27.ACos- calculates arc cosine in radians.

    Syntax:
    ACos(Expression)

    Parameter :

    • Expression(Number). The cosine value (in the range -1 ... 1) by which the angle is determined.
    28.ASin- calculates the arcsine in radians.

    Syntax:
    ASin(Expression)

    Parameter :

    • Expression(Number). The sine value (in the range -1 ... 1) by which the angle is determined.
    29.ATan- calculates the arctangent in radians.

    Syntax:
    ATan(Expression)

    Parameter :

    • Expression(Number). The tangent value by which the angle is determined.
    30.Cos- calculates cosine.

    Syntax:
    Cos(Expression)

    Parameter :

    • Expression
    31. Exp- raising the number e to a power.

    Syntax:
    Exp(Expression)

    Parameter :

    • Expression(Number). The meaning of the degree.
    32.Log- calculates the natural logarithm.

    Syntax:
    Log(Expression)

    Parameter :

    • Expression
    33.Log10- calculates the logarithm of X to base 10.

    Syntax:
    Log10(Expression)

    Parameter :

    • Expression(Number). The original number is greater than 0.
    34. Pow- exponentiation.

    Syntax:
    Pow(Base, Indicator)

    Parameters:

    • Base(Number). The basis of the operation of exponentiation.
    • Indicator(Number). Exponent.
    35. Sin- calculates the sine.

    Syntax:
    Sin(Expression)

    Parameter :

    • Expression(Number). Specified in radians.
    36. Sqrt- calculates the square root.

    Syntax:
    Sqrt(Expression)

    Parameter :

    • Expression(Number). Non-negative number.
    37. Tan- calculates the tangent.

    Syntax:
    Tan(Expression)

    Parameter :

    • Expression(Number). The sine value by which the angle is determined.
    38. Round- rounds the original number to the required bit depth. The rounding mode is standard (1.5 as 2).

    Syntax:
    Env(Expression, Bit depth)

    Parameters:

    • Expression(Number). Original number;
    • Bit depth(Number). The number of decimal places to round to.
    39. Int- cuts off the fractional part of a number.

    Syntax:
    Object(Expression)

    Parameter :

    • Expression(Number). Fractional number.
    40. Functions of common modules

    A data composition engine expression may contain calls to functions of global common configuration modules. No additional syntax is required to call such functions.

    Example:
    AbbreviatedName(Documents.Link, Documents.Date, Documents.Number)

    In this example, the "AbbreviatedName" function will be called from the general configuration module.
    Note that the use of common module functions is only permitted if the appropriate data composition processor parameter is specified.
    Additionally, functions of common modules cannot be used in custom field expressions.

    41. Resentation - this function returns a string representation of the passed value of a non-primitive type. For values ​​of a primitive type, returns the value itself.

    <Пустое значение>".

    Example:
    Presentation(Counterparty)

    42. String - this function converts the passed value into a string.

    If an array or a table of values ​​is used as a parameter, the function returns a string containing a string representation of all the elements of the array, separated by the characters "; ". If any element has an empty string representation, then the string "<Пустое значение>".

    Example:
    Row(SalesDate)

    43. ValueIsFilled

    For NULL values, Undefined always returns False.
    For Boolean values, it always returns True.
    For other types, returns True if the value differs from the default value for the given type.

    Example:
    ValueFilled(DeliveryDate)

    44. LevelInGroup - this function gets the current recording level relative to the grouping.

    Can be used to obtain the nesting level of a record in a hierarchical grouping.

    Example:
    LevelInGroup()

    45. ValueType

    Syntax:
    ValueType(Expression)

    Parameter :

    • Expression(Line). String value type.
    Returns a value of type Type containing the value type of the function parameter.

    In this short note I want to show how you can summarize values ​​at various levels of grouping in a report using a data composition system.
    As shown in the image, only at the “Item Groups” grouping level, the “Order” resource is calculated, it displays how much needs to be ordered for the current item group based on certain conditions:


    This value can only be calculated at this grouping level, since there are no values ​​above or below to calculate. For example, at the level of detailed records, there is no data on the maximum quantity in a group, because this data is valid only for the group as a whole, and not for its individual components.

    Accordingly, now it is necessary to calculate the totals for the above groupings (“Warehouses”, “Warehouse Types”) and the overall total.
    To do this, use the function CalculateExpressionWithGroupArray:
    EVALUATE EXPRESSIONWITHGROUPARRAY (EVALEXPRESSIONWITHGROUPARRAY)
    Syntax:
    EvaluateExpressionWithGroupArray(,)
    Description:
    The function returns an array, each element of which contains the result of evaluating an expression for grouping by the specified field.
    The layout builder, when generating a layout, converts function parameters into terms of data layout layout fields. For example, the Account field will be converted to DataSet.Account.
    The layout builder, when generating expressions for the output of a custom field whose expression contains only the CalculateArrayWithGroupArray() function, generates the output expression so that the output information is ordered. For example, for a custom field with the expression:

    CalculateExpressionWithGroupArray("Amount(AmountTurnover)", "Counterparty")
    The layout builder will generate the following expression for output:

    ConnectRows(Array(Order(CalculateExpressionWithGroupingValueTable("View(Sum(DataSet.SumTurnover)),Sum(DataSet.SumTurnover)",,"DataSet.Account"),"2")))

    Parameters:

    Type: String. The expression to be evaluated. Line, for example, Amount(AmountTurnover).

    Type: String. Grouping field expressions – expressions of grouping fields, separated by commas. For example, Contractor, Party.

    Type: String. An expression describing the selection applied to detail records. The expression does not support the use of aggregate functions. For example,DeletionFlag = False.

    Type: String. An expression describing the selection applied to group records. For example, Amount(AmountTurnover) > &Parameter1.
    Example:

    Maximum(CalculateExpressionWithGroupArray("Amount(AmountTurnover)", "Counterparty"));

    A detailed description of the function syntax can be found at http://its.1c.ru/db/v837doc#bookmark:dev:TI000000582
    Now, for the calculation, we duplicate the “Order” field, with different values ​​“Calculate by...”, using the following expressions, note that in each higher level the values ​​of the levels below the groupings are used.

    As a result, we get the following construction:

    Content
    1 Data composition system expression language
    2 Literals
    2.1 String
    2.2 Number
    2.3 Date
    2.4 Boolean
    2.5 Meaning
    3 Operations on numbers
    3.1 Unary –
    3.2 Unary +
    3.3 Binary -
    3.4 Binary+
    3.5 Work
    3.6 Division
    3.7 Remainder
    4 String operations
    4.1 Concatenation (Binary +)
    4.2 Similar
    5 Comparison operations
    5.1 Equal
    5.2 Not equal
    5.3 Less
    5.4 More
    5.5 Less than or equal to
    5.6 Greater than or equal to
    5.7 Operation B
    5.8 Operation of checking the presence of a value in a data set
    5.9 Operation of checking a value for NULL
    5.10 Operation of checking a value for NULL inequality
    6 Logical operations
    6.1 Operation NOT
    6.2 Operation I
    6.3 OR operation
    7 Aggregate functions
    7.1 Amount
    7.2 Quantity
    7.3 Number of different
    7.4 Maximum
    7.5 Minimum
    7.6 Average
    8 Other operations
    8.1 SELECT operation
    9 Rules for comparing two values
    10 Working with NULL value
    11 Operation priorities
    12 Functions of the data composition system expression language
    12.1 Calculate
    12.2 Level
    12.3 NumberInOrder
    12.4 Number in Order in Grouping
    12.5 Format
    12.6 Beginning of the Period
    12.7 End of Period
    12.8 AddToDate
    12.9 Date Difference
    12.10 Substring
    12.11 Line Length
    12.12 Year
    12.13 Quarter
    12.14 Month
    12.15 Day of the Year
    12.16 Day
    12.17 Week
    12.18 Day of the Week
    12.19 Hour
    12.20 Minute
    12.21 Second
    12.22 Express
    12.23 YesNull
    12.24 Functions of common modules

    Data Composition System Expression Language

    The data composition system expression language is designed to write expressions used in various parts of the system.

    Expressions are used in the following subsystems:

    • data layout diagram - to describe calculated fields, total fields, relationship expressions, etc.;
    • data layout settings - to describe custom field expressions;
    • data layout layout - for describing expressions for connecting data sets, describing layout parameters, etc.

    Literals

    The expression may contain literals. The following types of literals are possible:

    • Line;
    • Number;
    • Date;
    • Boolean.

    Line

    A string literal is written in “” characters, for example:

    “String literal”


    If you need to use the “” character inside a string literal, you should use two such characters.

    For example:

    “Literal ““in quotes”““

    Number

    The number is written without spaces, in decimal format. The fractional part is separated using the "." symbol. For example:

    Date

    A date literal is written using the key literal DATETIME. After this keyword, the year, month, day, hours, minutes, seconds are listed in parentheses, separated by commas. Time specification is not required.

    For example:
    DATETIME(1975, 1, 06) – January 6th, 1975
    DATETIME(2006, 12, 2, 23, 56, 57) – December 2, 2006, 23 hours 56 minutes 57 seconds, 23 hours 56 minutes 57 seconds

    Boolean

    Boolean values ​​can be written using the literals True (True), False (False).

    Meaning

    To specify literals of other types (system enumerations, predefined data), the keyword Value is used, followed by the name of the literal in parentheses.
    Value(AccountType. Active)

    Operations on numbers

    Unary –

    This operation is intended to change the sign of a number to the opposite sign. For example:
    -Sales.Quantity

    Unary +

    This operation does not perform any actions on the number. For example:
    +Sales.Quantity

    Binary -

    This operation is intended to calculate the difference of two numbers. For example:
    RemainsAndTurnover.InitialRemainder – RemainsAndTurnover.FinalRemainder
    RemainsAndTurnover.InitialRemaining - 100
    400 – 357

    Binary +

    This operation is designed to calculate the sum of two numbers. For example:
    RemainsAndTurnover.InitialRemaining + RemainsAndTurnover.Turnover
    RemainsAndTurnover.InitialRemaining + 100
    400 + 357

    Work

    This operation is designed to calculate the product of two numbers. For example:
    Nomenclature.Price * 1.2
    2 * 3.14

    Division

    This operation is designed to obtain the result of dividing one operand by another. For example:
    Nomenclature.Price / 1.2
    2 / 3.14

    Remainder of division

    This operation is designed to obtain the remainder when one operand is divided by another. For example:
    Nomenclature.Price% 1.2
    2 % 3.14

    String Operations

    Concatenation (Binary +)

    This operation is designed to concatenate two strings. For example:
    Nomenclature.Article + “: ”+ Nomenclature.Name

    Like

    This operation checks whether the string matches the passed pattern.

    The value of the LIKE operator is TRUE if the value<Выражения>satisfies the pattern, and FALSE otherwise.

    The following characters in<Строке_шаблона>have a meaning different from just another character in the line:

    • % - percentage: a sequence containing zero or more arbitrary characters;
    • _ - underscore: one arbitrary character;
    • […] - one or more characters in square brackets: one character, any of those listed inside the square brackets. The enumeration may contain ranges, for example a-z, meaning an arbitrary character included in the range, including the ends of the range;
    • [^...] - in square brackets a negation icon followed by one or more characters: any character except those listed after the negation icon;

    Any other symbol means itself and does not carry any additional load. If one of the listed characters needs to be written as itself, then it must be preceded by<Спецсимвол>, specified after the SPECIAL CHARACTER keyword (ESCAPE).

    For example, template
    “%ABV[abvg]\_abv%” SPECIAL CHARACTER “\”

    means a substring consisting of a sequence of characters: the letter A; letters B; letters B; one digit; one of the letters a, b, c or d; underscore; letters a; letters b; letters v. Moreover, this sequence can be located starting from an arbitrary position in the line.

    Comparison Operations

    Equals

    This operation is intended to compare two operands for equality. For example:
    Sales.Counterparty = Sales.NomenclatureMainSupplier

    Not equal

    This operation is intended to compare two operands for inequality. For example:
    Sales. Counterparty Sales. Nomenclature Main Supplier

    Less

    This operation is designed to check that the first operand is less than the second. For example:
    SalesCurrent.Amount

    More

    This operation is designed to check that the first operand is greater than the second. For example:
    SalesCurrent.Sum > SalesPast.Sum

    Less than or equal to

    This operation is designed to check that the first operand is less than or equal to the second. For example:
    SalesCurrent.Amount

    Greater than or equal to

    This operation is designed to check that the first operand is greater than or equal to the second. For example:
    SalesCurrent.Amount >= SalesPast.Amount

    Operation B

    This operation checks for the presence of a value in the passed list of values. The result of the operation will be True if the value is found, or False otherwise. For example:
    Item B (&Product1, &Product2)

    Operation of checking the presence of a value in a data set

    The operation checks for the presence of a value in the specified data set. The validation dataset must contain one field. For example:
    Sales. Counterparty To Counterparties

    Operation of checking a value for NULL

    This operation returns True if the value is NULL. For example:
    Sales.Counterparty IS NULL

    Operation of checking a value for NULL inequality

    This operation returns True if the value is not NULL. For example:
    Sales.Counterparty IS NOT NULL

    Logical operations

    Logical operations accept expressions of type Boolean as operands.

    Operation NOT

    The NOT operation returns True if its operand is False and False if its operand is True. For example:
    NOT Document.Consignee = Document.Consignor

    Operation I

    The AND operation returns True if both operands are True, and False if one of the operands is False. For example:
    Document.Consignee = Document.Consignor AND Document.Consignee = &Counterparty

    OR operation

    The OR operation returns True if one of its operands is True, and False if both operands are False. For example:
    Document.Consignee = Document.Consignor OR Document.Consignee = &Counterparty

    Aggregate functions

    Aggregate functions perform some action on a set of data.

    Sum

    The aggregate function Sum calculates the sum of the values ​​of the expressions passed to it as an argument for all detail records. For example:
    Amount(Sales.AmountTurnover)

    Quantity

    The Count function calculates the number of values ​​other than NULL. For example:
    Quantity(Sales.Counterparty)

    Number of different

    This function calculates the number of distinct values. For example:
    Quantity(Various Sales.Counterparty)

    Maximum

    The function gets the maximum value. For example:
    Maximum(Remaining.Quantity)

    Minimum

    The function gets the minimum value. For example:
    Minimum(Remaining.Quantity)

    Average

    The function gets the average of non-NULL values. For example:
    Average(Remaining.Quantity)

    Other operations

    Operation SELECT

    The Select operation is intended to select one of several values ​​when certain conditions are met. For example:
    Select When Amount > 1000 Then Amount Otherwise 0 End

    Rules for comparing two values

    If the types of the values ​​being compared are different from each other, then the relationships between the values ​​are determined based on the precedence of the types:
    NULL (lowest);
    Boolean;
    Number;
    Date;
    Line;
    Reference types

    The relationships between different reference types are determined based on the reference numbers of the tables corresponding to a particular type.

    If the data types are the same, then the values ​​are compared according to the following rules:
    for the Boolean type the value TRUE is greater than the value FALSE;
    the Number type has the usual comparison rules for numbers;
    for the Date type, earlier dates are less than later ones;
    for the String type - comparison of strings in accordance with the established national characteristics of the database;
    reference types are compared based on their values ​​(record number, etc.).

    Working with NULL Value

    Any operation in which one of the operands is NULL will produce a NULL result.

    There are exceptions:
    The AND operation will return NULL only if none of the operands is False;
    The OR operation will only return NULL if none of its operands are True.

    Operation priorities

    The operations have the following priorities (the first line has the lowest priority):
    OR;
    AND;
    NOT;
    B, IS NULL, IS NOT NULL;
    =, <>, <=, <, >=, >;
    Binary +, Binary – ;
    *, /, %;
    Unary +, Unary -.

    Data Composition System Expression Language Functions

    Calculate

    The Calculate function is designed to calculate an expression in the context of some grouping. The function has the following parameters:
    Expression. Type String. Contains a calculated expression;
    Grouping. Type String. Contains the name of the grouping in the context of which the expression is to be evaluated. If an empty string is used as the grouping name, the calculation will be performed in the context of the current grouping. If the GrandTotal string is used as the group name, the calculation will be performed in the context of the grand total. Otherwise, the calculation will be performed in the context of the parent grouping with the same name. For example:
    Sum(Sales.SumTurnover) / Calculate("Sum(Sales.SumTurnover)", "Total")

    In this example, the result will be the ratio of the amount for the "Sales.AmountTurnover" field of the grouping record to the amount of the same field in the entire layout.

    Level

    The function is designed to obtain the current recording level.

    Example:
    Level()

    NumberInOrder

    Get the next sequence number.

    Example:
    NumberByOrder()

    NumberInOrderInGrouping

    Returns the next ordinal number in the current grouping.

    Example:
    NumberByOrderInGroup()

    Format

    Get a formatted string of the passed value.

    The format string is set in accordance with the 1C:Enterprise format string.

    Parameters:
    Meaning;
    Format string.

    Example:
    Format(Invoices.Doc Amount, "NPV=2")

    Beginning of the Period

    Parameters:

      • Minute;
      • Day;
      • Week;
      • Month;
      • Quarter;
      • Decade;
      • Half year.

    Example:
    StartPeriod(DateTime(2002, 10, 12, 10, 15, 34), "Month")

    Result:

    01.10.2002 0:00:00

    End of Period

    The function is designed to extract a specific date from a given date.

    Parameters:

    • Date. Type Date. Specified date;
    • Period type. Type String. Contains one of the following values:
      • Minute;
      • Day;
      • Week;
      • Month;
      • Quarter;
      • Decade;
      • Half year.

    Example:
    EndPeriod(DateTime(2002, 10, 12, 10, 15, 34), "Week")

    Result:

    13.10.2002 23:59:59

    AddToDate

    The function is designed to add a certain value to a date.

    Parameters:

    • Magnification type. Type String. Contains one of the following values:
      • Minute;
      • Day;
      • Week;
      • Month;
      • Quarter;
      • Decade;
      • Half year.
    Amount – by how much you need to increase the date. Type Number. The fractional part is ignored.

    Example:
    AddToDate(DateTime(2002, 10, 12, 10, 15, 34), "Month", 1)

    Result:

    12.11.2002 10:15:34

    DifferenceDate

    The function is designed to get the difference between two dates.

    Parameters:

    • Expression. Type Date. Original date;
    • Expression. Type Date. Subtracted date;
    • Difference type. Type String. Contains one of the values:
      • Second;
      • Minute;
      • Day;
      • Month;
      • Quarter;

    Example:
    DATEDIFFERENCE(DATETIME(2002, 10, 12, 10, 15, 34),
    DATETIME(2002, 10, 14, 9, 18, 06), "DAY")

    Result:

    Substring

    This function is designed to extract a substring from a string.

    Parameters:

    • Line. Type String. The string from which the substring is extracted;
    • Position. Type Number. The position of the character from which the substring to be extracted from the string begins;
    • Length. Type Number. Length of the allocated substring.

    Example:
    SUBSTRING(Accounts.Address, 1, 4)

    Line Length

    The function is designed to determine the length of a string.

    Parameter:
    Line. Type String. A string whose length is specified.

    Example:
    Line(Counterparties.Address)

    This function is designed to extract the year from a Date type value.

    Parameter:
    Date. Type Date. The date by which the year is determined.

    YEAR(Expense.Date)

    Quarter

    This function is designed to extract the quarter number from a Date type value. The quarter number normally ranges from 1 to 4.

    Parameter
    Date. Type Date. The date by which the quarter is determined

    QUARTER(Expense.Date)

    Month

    This function is designed to extract the month number from a Date type value. The month number normally ranges from 1 to 12.
    Date. Type Date. The date by which the month is determined.
    MONTH(Expense.Date)

    Day of the Year

    This function is designed to obtain the day of the year from a Date type value. The day of the year normally ranges from 1 to 365 (366).
    Date. Type Date. The date by which the day of the year is determined.
    DAYYEAR(Expense.Date)

    Day

    This function is designed to obtain the day of the month from a Date type value. The day of the month normally ranges from 1 to 31.
    Date. Type Date. The date by which the day of the month is determined.
    DAY(Expense.Date)

    Week

    This function is designed to obtain the week number of the year from a Date type value. The weeks of the year are numbered starting from 1.
    Date. Type Date. The date by which week numbers are determined.
    WEEK(Expense.Date)

    Day of the Week

    This function is designed to obtain the day of the week from a Date type value. The normal day of the week ranges from 1 (Monday) to 7 (Sunday).
    Date. Type Date. The date by which the day of the week is determined.
    DAY OF THE WEEK(Expense.Date)

    This function is designed to obtain the hour of day from a Date type value. The hour of the day ranges from 0 to 23.
    Date. Type Date. The date by which the hour of the day is determined.
    HOUR(Expense.Date)

    Minute

    This function is designed to obtain the minute of the hour from a Date type value. The minute of the hour ranges from 0 to 59.
    Date. Type Date. The date by which the minute of the hour is determined.
    MINUTE(Expense.Date)

    Second

    This function is designed to obtain the second of a minute from a Date type value. The second of a minute ranges from 0 to 59.
    Date. Type Date. The date by which the seconds of the minute are determined.
    SECOND(Exp.Date)

    Express

    This function is designed to extract a type from an expression that may contain a compound type. If the expression contains a type other than the required type, NULL will be returned.

    Parameters:
    Expression to convert;
    Type indication. Type String. Contains a type string. For example, "Number", "String", etc. In addition to primitive types, this line may contain the name of the table. In this case, an attempt will be made to express a reference to the specified table.

    Example:
    Express(Data.Props1, "Number(10,3)")

    IsNull

    This function returns the value of the second parameter if the value of the first parameter is NULL.

    Otherwise, the value of the first parameter will be returned.

    Example:
    YesNULL(Amount(Sales.AmountTurnover), 0)

    Functions of common modules

    A data composition engine expression may contain calls to functions of global common configuration modules. No additional syntax is required to call such functions.

    Example:
    AbbreviatedName(Documents.Link, Documents.Date, Documents.Number)

    In this example, the "AbbreviatedName" function will be called from the general configuration module.

    Note that the use of common module functions is only permitted if the appropriate data composition processor parameter is specified.

    Additionally, functions of common modules cannot be used in custom field expressions.

    [you must register to view the link]