Working with a fixed layout in skd. SKD layouts Bookmark layout in the 1s data composition system

The most difficult thing to use layouts is filling in the “Layout” column on the “Layouts” tab in the ACS constructor.

In nature, there is a good reference on this issue. It helps to understand the basic principles. But still, each time you have to experiment with different types of layouts in order to understand whether a specific task can be solved using this tool or not. Therefore, I got the idea to post the results of the experiments in the form of an article, so that later I could refer to them and save time in the future. It is not necessary to read the text, it is enough to quickly go over the screenshots to choose the type of layout that is most suitable for the task being solved
In the article, I will repeat the mentioned help a bit in order to state some important details in a more understandable and specific language.

I conducted experiments on a report of the following type.

Field layout

This layout is applied to a specific cell, unlike the grouping and grouping header layouts, which are applied to the entire row.
It can be applied to grouping fields and resource fields


Group Header Layout

This kind of layout, as mentioned above, applies to the entire title bar.

Settings

If it is assigned to the topmost grouping, then it will be applied to the entire header of the report table. As you can see in the figure, the headers of the other groupings, as well as the headers of the resources, are hidden. Therefore, these headings have to be drawn manually. Sometimes this is required, for example, to merge cells in a header

Settings

Applying this layout for groupings of the second and lower levels usually does not make sense, because. the result obtained can hardly be applied

Settings

However, if you assign a height of 1 to the layout row, you can hide the headings of the groupings of the current and next levels. In the figure below, the titles Position and Employee are hidden.

Also noteworthy is the use of the Footer layout type, for example, to display signers.

Settings

Using Types Grand total As far as I understand it doesn't affect anything. I was unable to create a setting with these types for it to apply


Grouping layout

This layout applies to the entire grouping row. It can be used for some typical tasks, although it is not easy to guess how to use it.

If you apply this layout to the topmost grouping with the Heading type, then the table header is repeated under each grouping. Applying such a layout makes sense in cases where, for example, you need to insert page breaks before each grouping.

Settings

If we apply this scheme for grouping the lower level, then we get this:

Or, if you finish the columns, it will turn out like this

If the task arises to change the footer with totals, then you need to use this layout with the type Grand total basement or grand total heading. As far as I understood, these two layout types do the same thing

Settings

Resource Layout

The layout is only used for TABLE. It is applied at the intersection of groupings specified in the settings

Settings


Restrictions on using layouts

  1. In many cases, using layouts loses the ability for the user to customize the report. He will not be able to change the order of resources and groupings, disable resources and groupings, because while the report takes an incomprehensible form. This disadvantage does not apply only to the layout of the field.
  2. There is no way to design ONLY the title of the desired resource (or resource group) using the layout. For example, if you want to align resource titles to the center. You will have to complete the entire table header and get the restriction from clause 1
  3. It is not possible to issue ONLY the title of the results. For example, several times it was required to replace the word “Total” with the word “Total”. In this case, you will have to draw the entire line of totals and get the restriction from clause 1 or come up with something else.

Files

All the examples described above are attached to the article as a download file. It contains the ACS console with a set of circuits (embedded in it). The queries in the example do not access any database tables, so the examples run on any configuration in managed application mode.


IN

Let's create an external report that will display reporting information about the balance of the item and its turnover. The required information is requested by the request using a dataset of type "Request", which contains the text of the request:
CHOOSE
_DemoNomenclature.Link AS Nomenclature
PUT ActualNomenclature
FROM
Directory._DemoNomenclature HOW _DemoNomenclature
WHERE
NOT _DemoNomenclature.Removal Mark
AND NOT _DemoNomenclature.This isGroup
;

////////////////////////////////////////////////////////////////////////////////
CHOOSE
ActualNomenclature.Nomenclature,
_DemoRemains of Goods in Storage LocationsRemains and Turnovers. Storage Location,
_DemoRemains of Goods in Storage LocationsRemains and Turnovers.
_DemoRemains of goods in storage placesRemains and Turnovers.
_DemoRemains of Goods in Storage LocationsRemains and Turnovers. Quantity
_DemoRemains of goods in places of storageRemains and Turnovers.
_DemoRemains of Goods in Storage LocationsRemains and Turnovers. Quantity
FROM
ActualNomenclature AS ActualNomenclature
LEFT JOIN Accumulation Register._DemoRemains of Goods in Storage Locations. Remains and Turnovers AS _Demo
Software ActualNomenclature.Nomenclature = _Demo

As a result, the report contains the following fields (see Figure 1):

Since the information is taken from the virtual table "Balances and Turnovers", the ACS automatically creates two data parameters StartPeriod and EndPeriod, which are necessary to set the limits of the data sampling period. I prefer not to work with such parameters directly, but to set their values ​​through another parameter that will be available to the user for editing (see Figure 2).
The report copes with its task, but the report header is rather dry. During my work, I found several ways to design the report header:

  1. Setting the field headers on the ACS tab "Data sets";
  2. Setting field headers on the ACS "Settings" tab;
  3. Programmatic setting of field headers;
  4. Setting a report header using a layout;
  5. Refinement of the result (spreadsheet document);
Let's consider them in detail.

1. Setting headers on the ACS tab "Data sets"

Everything is simple here, put a tick in front of the "Title" field property (i.e., cancel the auto-title) and enter the required title text (see Figure 4).
If you want to set the appearance for the entire field, and not just for its title, then there is a "Design" field property, with which you can set some kind of field design, for example, change the font or set the background color (see Figure 5).
This is where my knowledge about the "Datasets" tab ends.

2. Setting the field headers on the ACS "Settings" tab

To set the title of the field, select the desired field, right-click to open the context menu and select "Set Title" (see Figure 6)
To group fields (for example, by type of information), you need to add a grouping field and place the required fields in it (see Figure 7), nesting is unlimited.
You can also play around with the "Location" property of the grouping field, which determines the type of field grouping.

These actions can also be performed in 1C:Enterprise mode by opening the report settings, BUT, the "Selected fields" item must be included in the report settings (see Figure 8).
This completes the easy part of setting up the report header. Of the advantages of the above actions: all configuration is performed by standard means. Of the minuses: the inability to set a multiline field header.

3. Programmatically setting field headers

The platform allows you to programmatically set field headers, moreover, set multi-line headers, which in turn makes it possible to flexibly and dynamically set field headers when generating a report.

To do this, in the report module, we define the procedure When LinkingResult. In this procedure, we will write the code to set the header of the fields.

// 1. Get user settings.
SettingsCD = ThisObject.SettingsComposer.GetSettings();

// 2. Get the value of the "Period" parameter, from which we determine the start and end dates of the period.
ParameterPeriod = NewDataCompositionParameter("Period");
Period = SettingsCD.DataParameters.FindParameterValue(ParameterPeriod).Value;
StartPeriod = Period.StartDate;
EndPeriod = Period.EndDate;

// 3. Prepare information about redefining the header of the fields. For this, let's create
// array that will contain information: FieldName - values ​​of the "Path" property in
// dataset (see Figure 1), Title - title text.
FieldList = New Array;
strStartPeriod = Format(StartPeriod, "DF=dd.MM.yyyy; DP="Empty date"");
FieldInitialRemainder = New Structure("FieldName, Header", "NumberInitialRemainder", "Remainder on " + Symbols.PS + strStartPeriod);
FieldList.Add(FieldInitialRemainder);
strEndPeriod = Format(EndPeriod, "DF=dd.MM.yyyy; DP="Empty date"");
FieldFinalRemainder = New Structure("FieldName, Header", "QuantityEndRemainder", "Remainder on " + Symbols.PS + strEndPeriod);
FieldList.Add(FieldFieldRemainder);

// 4. Get the list of fields that are in the "Remainders" grouping (see Figure 7) and
// set a new title by looping through the elements.
SelectedFields = SettingsCD.Choice.Items; // First level of fields.
SelectedFieldsRemainders = SelectedFields.Items; // Grouping fields remainders.
For each SelectedField Of SelectedFieldsRemainders Loop
For Each ElementArray From ListFields Loop
CompositionField = NewCompositionField(ArrayElement.FieldName);
If SelectedField.Field = LayoutField Then
SelectedField.Title = ArrayItem.Title;
EndIf;
EndCycle;
EndCycle;

// 5. Load the changed user settings back.
ThisObject.SettingsComposer.LoadSettings(KD Settings);

Report result (see Figure 10):
The method is harder than all of the above, but I like it.

4. Setting the report header using the layout

For more flexible customization of the appearance of the report, the ACS provides for the creation of layouts. In the report settings, let's create another grouping "detailed records" and set the name "Line DZ" for this grouping (see Figure 11).
On the "Layouts" tab, add a grouping header layout. For the layout in the spreadsheet document, we will create a report header (the report header should contain as many field headers as the detail record displays) and specify the area of ​​the spreadsheet document for the layout (see Figure 12).
As a result, the report has the following header (see Figure 13):

Figure 13. SKD layout as a report header
In my opinion, layouts have one big minus, it is the inability to rebuild for a given user grouping, so they should be used if the reporting form is regulated and cannot be changed. Try to set a grouping for the grouping "Line DZ" and you will see that the layout has gone astray.

The information technology support site has an article Using predefined layouts, which describes in detail the techniques for using layouts in SKD.

5. Refinement of the result (spreadsheet document)

This method uses the wonderful spreadsheet method FindText(), but to use this method, you need to disable the standard processing of generating the report result.

Let's get started. We disable the standard formation, for this, in the report module for the event When LinkingResult set the StandardProcessing variable to False and write our own layout of the result:
StandardProcessing = False;
Layout Layout Builder = New Data Layout Layout Layout Builder;
LayoutLayout = LayoutComposer.Run(
ThisObject.DataCompositionScheme,
ThisObject.SettingsComposer.Settings,
Decryption Data);
CompositionProcessor = NewDataCompositionProcessor;
LayoutProcessor.Initialize(LayoutLayout, DecodeData, True);
OutputProcessor = New OutputProcessorofDataCompositionResultIntoSpreadsheetDocument;
OutputProcessor.SetDocument(DocumentResult);
OutputProcessor.Output(CompositionProcessor);
In more detail, the program layout of the report result is described in the article SKD. Software layout of the result.

The linked result is displayed in a spreadsheet document - this is the DocumentResult variable. Further, after generating the result and displaying it in a spreadsheet document, we write code to replace one cell text with another. For example, let's change the name of the group "Remains" in the header of the report to "Remains of the item" (see Figure 14):
Cell = DocumentResult.FindText("Remainders");
If Cell<>Undefined Then
Cell.Text = "Remainders of the item";
EndIf;

You can also set formatting for the found cell, see the properties of the spreadsheet document cell in the syntax assistant.

I recently discovered this method for myself, it is simple and allows you to work very flexibly with the report header, the main thing is that the cell text has a unique text.

P.S. maybe you have another way to design field headers in your arsenal?

This article will be useful to those programmers who have already developed reports on data composition system, but did not use the built-in layout setting mechanism.

When developing reports, sometimes you need to use a non-standard header, or you need to add captions. The article considers two options:

  1. Built-in mechanism for setting layouts directly in the ACS
  2. 2. Supplementing the result of the SKD in the code, using the usual layouts.

Suppose we already have a data composition report that looks like this.

We need to add a title and a caption so that the report looks like this:

Option 1 . You can use the layout design mechanism directly in SKD.

First we need to add groupings and give them names in the grouping tree. Let's add one grouping before the main grouping of the report, and name it " A cap". We add the second grouping at the end, and give it the name " Basement».

Next, on the Layouts tab, you need to add two grouping layouts and set areas for them. If the areas are quite complex (for example, some cells are combined into one), then they can be made in a regular layout and transferred here using the “copy, paste” mechanism. Here you can also pass parameters.

On the settings tab for the "Header" and "Footer" groupings, you need to turn off the "main" design layout by selecting the "no design" value. If this is not done, then the cells of our groupings will be in a frame.

Also for our groupings it is necessary to disable the selected fields.

Note. A similar version of the report can be developed using only SKD. Such a report will work both on a regular application and on a managed one.

Option 2. Using the result SKD and regular layouts (considered the option for a regular application)

Let's add a regular layout to the report.

Let's set the "Hat and Basement" areas in it.

In the form module, let's add the code for the "Generate" button, in which we first display the "Header" area, then the result of the data composition, then the "Footer" area.

Note. In order for the report to work in managed applications, you need to modify the procedure for the "generate" button.

In this article, I would like to talk about the nuances that I encountered when developing a report on the ACS, more precisely, with managing the appearance of the report layout, and the solutions that I applied to them.

I know that the layout in the ACS can be replaced (changed) using coding directly in the report form, but for me it was fundamentally important to make changes in the ACS without resorting to coding.

The text of the request in the report was as follows:

SELECT Nomenclature. Name, Nomenclature. Code, Nomenclature. Base Unit of Measure, Nomenclature. Unit of Measurement Places, Nomenclature. Residue Storage Unit, Nomenclature. UnitFor Reports, Nomenclature. Commentary, Nomenclature. Article, Nomenclature. Reference AS Nomenclature FROM Handbook. Nomenclature AS Nomenclature WHERE NOT Nomenclature. This group

Moment 1. Arbitrary headings of the report and columns.


By default, ACS has the ability to display an arbitrary title text. This is done in the ACS settings:

at the output we get:

But if the report and column headings must be arbitrary, then this option is not suitable. So I did the following:

Specified a name for detailed records:


I drew the layout I needed in SKD

In the same place, on the "Layout" tab, I marked the boundaries of the layout of the grouping header:

and specified the group name:

then marked the area of ​​the layout that you want to display in the report header:

If you generate a report, then:

not quite what I wanted to get. For myself, I found the following way to solve this problem - I made the background color and frame of the layout area, which is the report title, white:

and the output is the desired type of report:

Moment 2. Arbitrary interpretation of report fields.

The task is the following - when you double-click on the "Article" field, it should be possible to open the item card that generated this line.

In the report above, if you double-click on any field, you will not be able to open the item card:

For example, if you click on the "Article" field, we get the following:

The solution is:

Adding a field layout:

specify the field (Article), when clicking on which the item card should open:

in the layout, fill any empty field with the text "Article", specify in the properties - Filling = "Parameter", Decryption Parameter = "Nomenclature Explanation":

and specify this field field layout area:

After that, the layout options should appear:

In these parameters, we specify the expression for "Nomenclature Decoding", in my case it is a link to the nomenclature:


We get the opportunity to open the product card when clicking on the "Article" field:

I think there are developers who have encountered similar nuances and solved them in other ways, but that's another article...

The report is based on real events, appearance, query text and column names have been changed in the interests of the article.

Today we will consider the solution of an interesting problem - displaying images in a report.

What can it be useful for?

Here a few examples:

  • Price list with pictures of products and a logo in the header
  • Employee profiles with photos
  • Reconciliation of settlements with a seal and signature in the basement
  • Reports/print forms with print scan

In the video, we also analyze program formation SKD report. This reporting method is used in typical configurations- this is another reason to watch it carefully :)

Predefined layouts in SKD

With predefined layouts, you can override the default appearance of a report.

In this lesson, in addition to setting the problem, we will consider:

  • Storing binary data in a model configuration
  • Ability to use ACS layouts for displaying images

Software generation of a report on the ACS

To solve the problem of displaying images in a report on the ACS, it is necessary to generate it programmatically.

It is during the program generation of the report that it is possible to refer to binary data.

During this lesson, we will:

  • Outputting the layout result to a spreadsheet document
  • Using the DataDecryption object
  • Getting binary data from the database
  • Programmatic creation of drawings in a spreadsheet document

Displaying an image in the ACS report

In this lesson, we perform the final steps: we display the previously obtained binary data in a report.

To do this, the figure is added to the spreadsheet document, after which it is displayed in the report.

Universality of the algorithm for displaying pictures

The developed algorithm for displaying images is universal - with any change in the structure of the report, the algorithm continues to work.

Actually, this is what we will prove in this lesson.

In addition, we will consider the feature of the background report generation on the ACS (building a report using scheduled tasks).

Displaying an image in the header of a report

Often you need to display a static image in the header or footer of a report.

It would seem a simple task, but in the case of ACS, you need to know how to solve it:

  • Step 1. Programmatically generate a report
  • Step 2. Create a separate layout with the desired header or footer
  • Step 3. Before filling out the ACS report, display a section with the necessary data.

This video shows the solution to the problem.

Enjoy watching! :)

Over the past few days, we have been publishing materials on SKD.

But what if the programmer / implementer of 1C does not know ACS? Maybe it really doesn't matter?

Ok, let's look at what will await a specialist who writes reports "on the knee" (for example, using manual output to a spreadsheet document).

Don't shoot the pianist, he plays the best he can.

reports practically in all standard configurations based on SKD.

For a specialist without knowledge of ACS, the revision of standard reports becomes a lottery - why and how a particular figure is displayed in the report, how to add new sources, where to edit the calculated figures in the code ...

SKD - reporting standard in typical configurations, and 1C does not write comments based on those who have not yet studied the standards :)

To hell with time...

Without ACS, report development is largely manual.

This, of course, is cool - to go out like a rambo with a screwdriver in his teeth and, like, do everyone :)

As a result - high labor costs for report development and debugging. And this will be at least alarming for any manager/customer: “It’s strange, but does he really understand this??”

And when it comes to the subsequent revision of the report, it often becomes a headache (especially if it is someone else's report) ...

Development trips to clients to change the grouping in the report

SKD allows you to receive quality reports without programming. The backbone is being done for a few minutes, further - bows.

And users can customize such reports without involving a programmer, form several presentation options - charts, graphs, lists, tables.

To achieve such versatility in reports built programmatically, not possible within a reasonable time.

Therefore - a bell, a tram, let's go ... This is such a professional growth for a 1C nickname ...

“You don’t have the same one, but with mother-of-pearl buttons? “Unfortunately, no…” (c)

And if some data needs to be obtained from another system - from another 1C database or not from 1C at all?

With the help of ACS, you can create a report that works with the data of the current information security and receives data from another source - no programming required.

Without ACS, external data will be obtained programmatically and not in the most trivial way.

If you want to master SKD professionally and daily apply in your work sign up for the course:

Support - 2 months. Course scope - 34 teaching hours.

Don't delay your learning!