Another language in Data Composition System

This forum is intended for cases when a problem can not be solved due to restrictions of the platform: a bug or lack of functionality.

#1
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Sep 19, 2014
Company: FirstBit Dubai

Hello!
The configuration uses multiple languages. You need to add the ability for the user to generate reports in the DCS in the selected language. In this case, the report generation language will differ from the current configuration and user language.

Using the LanguageCode property for a SpreadsheetDocument does not produce the desired results.
Is it technically possible for the platform to implement this requirement?
Platform version 8.3.17

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

Hello Igor,

in this case, you can make several DataCompositionSchemas (DCS) in one report, each language has its own DCS. And already when generating a report, depending on the language chosen by the user, generate the necessary data.

Please see screenshots and source code below. I also attached a sample of the simplest report with a choice of languages.


Code
Procedure OnComposeResult(ResultDocument, DetailsData, StandardProcessing)
   
   StandardProcessing = False;

   If language Then 
        SchemeDataComposition = GetTemplate("DataCompositionSchema_en");
    Else 
        SchemeDataComposition = GetTemplate("DataCompositionSchema_ru");
    EndIf;

    Settings = SettingsComposer.GetSettings();
    
    TemplateComposer       = New DataCompositionTemplateComposer;
    TemplateComposition    = TemplateComposer.Execute(SchemeDataComposition, Settings, DetailsData);
    CompositionProcessor   = New DataCompositionProcessor;
   
   CompositionProcessor.Initialize(TemplateComposition, , DetailsData);
   
   OutputProcessor = New DataCompositionResultSpreadsheetDocumentOutputProcessor;
   
   OutputProcessor.SetDocument(ResultDocument);
    OutputProcessor.Output(CompositionProcessor);   
   
EndProcedure

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

Hello Igor,

no such problem was found on the 8.3.17.1549 platform. Please clarify in what configuration you're working? Also please email a sample source code where the error occurs.

Best regards,
Aleksandr

 
#4
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Sep 19, 2014
Company: FirstBit Dubai

I create new configuration at platform 8.3.17.1549
Add objects:
- two languages
- one catalog
- one report

I add this code in object module in report

Code
Procedure OnComposeResult(ResultDocument, DetailsData, StandardProcessing)
   ResultDocument.LanguageCode = "ru";
EndProcedure


As a result, I don't get russian headers under english user.
What am I doing wrong?

 
#5
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Sep 19, 2014
Company: FirstBit Dubai

If I add this code, I don't get result

Code
Procedure OnComposeResult(ResultDocument, DetailsData, StandardProcessing)
   
   ResultDocument.LanguageCode = "ru";
   
   StandardProcessing = False;
   
   Settings = ThisObject.SettingsComposer.GetSettings();
   UserSettings = ThisObject.SettingsComposer.UserSettings;
   
   TemplateComposer = New DataCompositionTemplateComposer;
   CompositionTemplate = TemplateComposer.Execute(ThisObject.DataCompositionSchema, Settings, DetailsData);
   
   CompositionProcessor = New DataCompositionProcessor;
   CompositionProcessor.Initialize(CompositionTemplate,, DetailsData, True);
   
   OutputProcessor = New DataCompositionResultSpreadsheetDocumentOutputProcessor;
   OutputProcessor.SetDocument(ResultDocument);
   
   OutputProcessor.BeginOutput();
   
   ResultItem = CompositionProcessor.Next();
   While ResultItem <> Undefined Do
      OutputProcessor.OutputItem(ResultItem);
      ResultItem = CompositionProcessor.Next();
   EndDo;

   OutputProcessor.EndOutput();
   
   ResultDocument.LanguageCode = "ru";
   
EndProcedure


Under the English user, I still get English headers
And only russian user, I get russian headers

 
Subscribe
Users browsing this topic (guests: 1, 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.