Internet Windows Android

Skd layouts. Working with a fixed layout in the skd Programmatically change the layout of the skd design

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.

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 LocationsRemains and Turnovers. Quantity
_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 drawback, it is the inability to rebuild to 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);
For more details on the program layout of the report result, see the article.

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.

how to create your layout in the data composition system (SKD).

We will train on the Trade Management 11 configuration.

Task. It is necessary to implement the printing of the invoice in the following form:

1. Let's create an external report. Let's create the main data composition scheme (SKD). How to create a request, define parameters, I will omit resources. In the settings we define 3 groupings.

2. Set names for all groupings: Header, TChProducts (table), Basement.

3. To define a fixed layout, go to the "Layouts" tab

4. Let's create a design layout for the "Header" grouping. The grouping header includes the following fields: Number, Date, Consignor, Consignee.

Select "Add Group Layout". In the dialog that opens, select the grouping name "Header" and the layout type "Header"

In the right window, as for a regular printable layout, we will set the properties of the cells where the document header will be located and set the borders of the Header group design layout area. By default, the platform will try to assign expressions for all parameters that fall within the output range.

5. To display the tabular part, you will need to create 3 design layouts:

Grouping header layout - for displaying the table header
Grouping layout - for displaying table rows
Grouping layout - to display the total for the table.

Let's add a grouping header layout to display the grouping header (table header). In the dialog that opens, select the grouping name "TCProducts" and the layout type "Header". In the right window, set the cell properties.

Let's add a grouping layout to display the grouping values. In the dialog that opens, select the grouping name "TCProducts" and the layout type "Header". In the right window, set the cell properties.

Let's add a grouping layout for displaying grouping totals. In the dialog that opens, select the grouping name "TCProducts" and the layout type "Grand total header". In the right window, set the cell properties.

6. Let's add a grouping layout to display the footer of our printable. In the dialog that opens, select the grouping name "Footer" and the layout type "Header".

7. So that the general layouts do not affect our created layout, you need to set the design layout "No design" on the "Other settings" tab.

That's all. The end result will look like:

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.

Users can customize these 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!