How to show report result in group level 1 automatically?

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

When I generate reports, shows group level all open. How get results in group level 1 when I generate the report?

 
#2
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hello Eyup,

specify me please - do you make a report using "Data composition system"?

 
#3
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

Yes I am

 
#4
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hi Eyup,

you should take the following steps:

1. open the report program module (screenshot 1)

2. and enter the following code there:

Code
Procedure OnComposeResult(ResultDocument, DetailsData, StandardProcessing)
   
   StandardProcessing = False;
   
   TemplateComposer = New DataCompositionTemplateComposer;
   Template = TemplateComposer.Execute(DataCompositionSchema, SettingsComposer.Settings, DetailsData);
   
   CompositionProcessor = New DataCompositionProcessor;
   
   CompositionProcessor.Initialize(Template, , DetailsData);
   
   OutputProcessor = New DataCompositionResultSpreadsheetDocumentOutputProcessor;
   
   OutputProcessor.SetDocument(ResultDocument);
   
   OutputProcessor.Output(CompositionProcessor);
   
   ResultDocument.ShowRowGroupLevel(1);   
   ResultDocument.ShowRowGroupLevel(0);   
   
EndProcedure


Pay attention to the last lines - we can group the report levels we need.

Download scr_1.png (21.66 KB)
 
#5
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

It is worked for just one table. I have nested reports. Here is the result;

 
#6
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Attach your report here please

 
#7
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

I hope I could attached

 
#8
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hm...

even when using nested reports, the code above collapses groupings...

What platform version are you using?

 
#9
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

I am using 8.3.23.

 
#10
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hello Eyup,

I checked on platform 8.3.23 - nested reports are collapsed.

Maybe can you give me a dump from your program, or something like that, so that I can see your code at work?

 
#11
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

Hi Mr. Biryukov, the dump is more than 200 Mb. Is it possible to send it with mail?

I tried to understand what is happening and I realize that first nested schema is working and others cannot executed. I delete first nested schema and same result others can not work with this code. There are 3 nested schema and two of them can not execute with "TemplateComposer.Execute()".

 
#12
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

I found the problem, that two nested schemas have date parameters. If I gave it behind user interface it is working. So how can I make it work with user period choice?

 
#13
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Mar 6, 2018
Company: Bodega LLC

Sir thank you for your kindly helps, I found the way, now it is working. Here is I add the code;

Code
StandardProcessing = False;
TemplateComposer = New DataCompositionTemplateComposer; 
DataCompositionSchema.NestedDataCompositionSchemas.Get(1).Schema.Parameters.Bas.Value = ThisObject.SettingsComposer.UserSettings.Items[0].Value.StartDate;
DataCompositionSchema.NestedDataCompositionSchemas.Get(1).Schema.Parameters.Bit.Value = ThisObject.SettingsComposer.UserSettings.Items[0].Value.EndDate;
DataCompositionSchema.NestedDataCompositionSchemas.Get(2).Schema.Parameters.Bas.Value = ThisObject.SettingsComposer.UserSettings.Items[1].Value.StartDate;
DataCompositionSchema.NestedDataCompositionSchemas.Get(2).Schema.Parameters.Bit.Value = ThisObject.SettingsComposer.UserSettings.Items[1].Value.EndDate; 
   
Template = TemplateComposer.Execute(DataCompositionSchema, SettingsComposer.Settings, DetailsData);
   
CompositionProcessor = New DataCompositionProcessor;
CompositionProcessor.Initialize(Template, , DetailsData);

OutputProcessor = New DataCompositionResultSpreadsheetDocumentOutputProcessor;
OutputProcessor.SetDocument(ResultDocument);
OutputProcessor.Output(CompositionProcessor);
ResultDocument.ShowRowGroupLevel(5);
ResultDocument.ShowRowGroupLevel(4);
ResultDocument.ShowRowGroupLevel(3);
ResultDocument.ShowRowGroupLevel(2);
ResultDocument.ShowRowGroupLevel(1);
ResultDocument.ShowRowGroupLevel(0);

 
#14
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hello Eyup,

I'm glad you figured out the problem! And other developers will now be able to use your experience too!

 
Subscribe
Users browsing this topic (guests: 2, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.