1C:Enterprise 8. Practical Developer’s Guide. Lesson 7. Simple Report.

Lesson 7. Simple Report

Estimated duration of the lesson is 25 minutes.

CONTENT:

During this lesson we will familiarize ourselves with the configuration object named Report. You will learn how to use them and will create a report that will be used to display the register records and Balance Of Materials in our company.

The goal of this lesson is limited to demonstrating the method of creating reports using a simple example. This is why we will not discuss in details data composition schema that is used to generate any report. This aspect will be covered in details during the lesson "Reports".

Understanding the Report Object

A configuration object named Report is intended to declare the algorithms available to the users to obtain the output they need. The algorithms for structuring the output data are defined using visual design tools or by means of the 1C:Enterprise script. In practice, Report objects will present various tables with output data, summary data, charts, etc.

Adding a Report

In the Designer Mode

Now we have everything we need to get some output data. Therefore, we are going to generate a report that will display receipts, expenses, and the balance of materials (fig. 7.1).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Using this example, we will demonstrate how you can quickly and easily develop a report using only visual development tools without writing any single line of code.

Open our practice configuration in the Designer and create a new Report configuration object.

To do so, highlight the Reports branch in the configuration object tree and click Add in the configuration window command bar (fig. 7.2).

In the configuration object editor that opens use the Main tab to enter a name for the report - Materials.

We will not enter any other properties to define object presentation within the application interface. Instead we will use object Synonym that is created automatically based on the object name.

Next we will create the basis for generating any report - data composition schema. To do so, click Open Data Composition Schema or the opening button 1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report marked with a magnifying glass (fig. 7.3).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.2. Creating a new report configuration object

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.3. Creating a data composition schema for a report

Template

Since the report that we are creating does not have any data composition schema yet, you will be prompted to create a new schema. From the configuration's perspective, a data composition schema is a template so a template wizard will be opened where you will be able to select the only available template type - Data Composition Schema (fig. 7.4).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.4. Creating a data composition schema for a report

Click Finish.

Data Composition Schema

A new template will be created by the platform containing the data composition schema and the data composition schema wizard will be opened immediately.

The wizard has a wide range of features for visual report design, but now we will use its basic features only merely specify the data we want to see when our report is generated.

Data Set

Add a new data set - query. To do so, click Add or open the context menu of the Data Sets branch (fig. 7.5).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.5. Adding a data set in Data Composition Wizard

Creating a Query Text

To create a query text, launch the query wizard by clicking the Query Wizard button (fig. 7.6).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Query wizard is a tool intended to help the developer by offering the means to generate a query with visual tools. Even a user unfamiliar with the query language can use the wizard to create a query with a correct syntax.

The Database list displays the tables used to generate a query. Based on the data in the tables, we can generate a report.

If you now expand the AccumulationRegisters branch, you will see that this branch contains several automatically generated virtual tables in addition to the tables for the BalanceOfMaterials register (fig. 7.7).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

These virtual tables are created automatically for the registers and are mainly used to generate various reports. Since we want to see both the Balance Of Materials and information about their receipts and expenses, we will opt for the virtual table named BalanceOfMaterials.BalancesAndTurnovers.

Expand this table (fig. 7.8).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.8. Table BalanceOfMaterials.BalanceAndTurnovers

As you can see, this table contains the dimensions of the BalanceOfMaterials register - Material and Warehouse, in addition to the opening and closing balance, as well as values for receipt, expense and turnover of all the resources from the BalanceOfMaterials register.

Now begin to select the table fields in the order we want by double-clicking them.

First select Warehouse and Material.

Next select QuantityOpeningBalance, QuantityReceipt, QuantityExpense Finally, select QuantityClosingBalance.

NOTE

You can move the highlighted items between lists by dragging and dropping them or by double-clicking them. Or you can use the buttons 1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report, 1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report, 1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report, 1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report.

At this point the Fields window should be populated as follows (fig. 7.9):

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Click OK and return to the data composition schema wizard (fig. 7.10).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.10. The Data Composition Schema Wizard

The platform will populate the field Query with the query text generated using the wizard.

This field is basically a text editor where you can manually edit an existing query. Besides, you can also open the query wizard again and use it edit the query.

To make it easier to consume the information, we will not provide the query listing here and discuss it. This aspect will be covered in details during the lesson "Reports" in the section dedicated to the query language. In this situation (same as for many other reports) we can avoid the analysis and editing of the query text.

Note the list of fields in the data composition system that has been populated automatically in the upper part of the wizard. It includes the fields available for the current data set. In our situation this list has been populated automatically by 1C:Enterprise using the query text so you do not need to adjust it manually.

So we have discussed how the data for a report will be extracted. But we will see no results until we create default settings for our report. This is why we will create the basic report settings in order to display normal detailed records of the infobase.

In our situation these will include the records in the virtual table of the BalanceOfMaterials accumulation register selected in the same order as used to add them into the table.

Creating Report Settings

Switch to the Settings tab. In the upper right window you will see a hierarchical structure of our report.

To add a new item, highlight the Report root item in the report structure tree and open its context menu. Alternatively you can click Add in the command bar of the window or press Ins.

Add a grouping to the report (context menu - New Grouping). We will not enter the grouping field and will simply click OK instead.

In doing so, we have determined that the report will include the detailed infobase records, i.e. the records obtained when a query is executed without totals (fig. 7.11).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.11. Adding a new grouping to a report

The report structure will have a grouping named Detailed records.

Now we will set up the fields that will be displayed in the report result.

To do so, use the bottom window of the settings to navigate to the Selected Fields tab and drag and drop the following fields from the list of available fields:

  • Warehouse;
  • Material;
  • QuantityOpeningBalance;
  • QuantityReceipt;
  • QuantityExpense;
  • QuantityClosingBalance.

NOTE

You can add the available fields to the list of selected fields by dragging and dropping them; by double-clicking available fields; or by clicking Add to the right of the list of selected fields. You can reorder the selected fields later using Up and Down buttons or by dragging and dropping them.

This will result in the following arrangement of the report settings window (fig. 7.12).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.12. Report Settings Window

Next go to the Parameters tab and specify that the report parameters Begin of period and End of period will be included in the list of custom settings and these settings will be located directly in the report form, i.e. will serve as quick settings.

First specify that both parameters will be used in the report by checking respective fields in the right-hand column.

Next highlight one of the parameters, click Properties of custom settings item and check Include in custom settings (fig. 7.13).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.13. Defining a List of Subsystems where a Report Will Be Displayed

So before a report is actually generated, a user will be able to define a period for the report. For details on report parameters and custom settings, see later the lesson "Reports".

Finally, we will define the subsystems where our report will be displayed.

Close the data composition schema wizard and in the editor of the Materials Report configuration object navigate to the Subsystems tab.

Check the following branches in the list of configuration subsystems: Goods Management, Rendering Services, and Accounting.

So a link to our report will be automatically added to the action panel of these subsystems (fig. 7.14).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.14. Defining a list of subsystems where a report will be displayed

In the 1C:Enterprise Mode

Launch 1C:Enterprise in the debugging mode and see how the report works.

In the 1C:Enterprise window that opens you see that action panels of the sections Accounting, Rendering Services, and Goods Management now have a new group of commands to execute reports and this group also includes a command to generate a report named Materials. Use this command (fig. 7.15).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

Fig. 7.15. Command to generate Materials report

This will open an automatically generated report form.

Now define the begin and end dates of the report period and click Generate (fig. 7.16).

1C:Enterprise 8. Practical Developer's Guide. Lesson 7. Simple Report

As you can see, our report looks good enough and fully reflects the register records for Materials within our company.

Quiz

  • What are the uses of the Report configuration object?
  • How does one create a report using the data composition schema wizard?
  • How does one display a report in various sections of the application?

Leave a Reply

Your email address will not be published. Required fields are marked *

1C:Enterprise Developer's Community