web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Why I can't assing a value to CurrReport.LANGUAGE?

(0) ShareShare
ReportReport
Posted on by

I want change the language of a report, before then 22.1 version of BC I use this code

                Lenguaje.SETRANGE(Lenguaje."Abbreviated Name", customer."Language Code");

                IF Lenguaje.FIND('-') THEN begin
                    CurrReport.LANGUAGE := Lenguaje."Language ID";
                end;
This code worked but when BC updated to 22.1 the code not work. CurrReport.LANGUAGE always take te¡he value that my web client language have assigned to it.
 
Example

If I assign to CurrReport.Language the value 1033 which is the code for the English language.
      CurrReport.Language := 1033
When reviewing the value of CurrReport.Language it shows us that the value is 2858 which is Spanish and is the language in which the BC client is configured.
Note: I have also tried to use CurrReport.LANGUAGE := LanguageCodeunit.GetLanguageIdOrDefault(CustomerInfo."LanguageCode").
I have the same question (0)
  • Nitin Verma Profile Picture
    21,710 Moderator on at

    Hi,

    You can run this table 

    2000000050 "Language Selection"
     
    and check what is the language id you want to use in report and try with below code.
    CurrReport.LANGUAGE := Language.GetLanguageID(languageid)
    Let me know if it works for you.
  • Fernando Jose R Profile Picture
    on at

    Hi,

    I tried what you said but the problem is that CurrReport.LANGUAGE don't storage the value that I assign it.

    for example I use

    CurrReport.LANGUAGE := LanguageCodeunit.GetLanguageId('ENU');

    Message(format(CurrReport.LANGUAGE));

    the Message show me 2058 that is for Spanish (Mexico) and is the language that I configure in the client of BC

  • Fernando Jose R Profile Picture
    on at

    _

  • YUN ZHU Profile Picture
    96,183 Super User 2025 Season 2 on at

    Hi, it seems to be related to the new feature below, I think you can test it.

    https://yzhums.com/35838/

    Hope this helps.

    Thanks.

    ZHU

  • Fernando Jose R Profile Picture
    on at

    Hi, then you say that this new fuctionality not permit modify the language of the report dynamicaly?

    I read the post and test the FastTab of Request Page and the Report Limits and Settings page and this work but the CurrReport.LANGUAGE(LanguageCodeunit.GetLanguageId(CustomerInfo."Language Code")); not works.

    You think this is a bug?

  • Fernando Jose R Profile Picture
    on at

    I have seen other thing, if i run the report manually and usign the report as a variable I can change the Language

    pageextension 50120 "Posted Sales Invoice Ext" extends "Posted Sales Invoice"
    {

        actions
        {
            addlast(processing)
            {
                action(testreport)
                {
                    ApplicationArea = All;
                    trigger OnAction()
                    var
                        sain: Record "Sales Invoice Header";
                        repo: Report "test report";
                        LanguageMgmt: Codeunit Language;
                    begin
                        sain := Rec;
                        sain.SetRecFilter();
                        repo.Language := LanguageMgmt.GetLanguageIdOrDefault(Rec."Language Code");
                        repo.SetTableView(sain);
                        repo.Run();
                    end;

                }
            }
        }
    }
    but if I want change inside the repo using CurrReport this not works.
    pageextension 50120 "Posted Sales Invoice Ext" extends "Posted Sales Invoice"
    {

        actions
        {
            addlast(processing)
            {
                action(testreport)
                {
                    ApplicationArea = All;
                    trigger OnAction()
                    var
                        sain: Record "Sales Invoice Header";
                    begin
                        sain := Rec;
                        sain.SetRecFilter();
                        Report.Run(Report::"test report", true, true, sain);
                    end;

                }
            }
        }
    }
    report 50104 "test report"
    {
        ApplicationArea = All;
        Caption = 'test report';
        DefaultLayout = RDLC;
        RDLCLayout = './test.rdl';
        UsageCategory = Administration;
        dataset
        {
            dataitem(SalesInvoiceHeader; "Sales Invoice Header")
            {
                RequestFilterFields = "No.";
                column(No; "No.")
                {
                }
                column(labelNo; labelNo)
                {
                }
                column(LanguageCode; "Language Code")
                {
                }
                column(labelLan; labelLan)
                {
                }

                trigger OnAfterGetRecord()
                begin

                    CurrReport.Language := LanguageMgmt.GetLanguageIdOrDefault("Language Code");
                    Message(Format(LanguageMgmt.GetLanguageIdOrDefault("Language Code")));
                    Message(format(CurrReport.Language));
                end;

            }
        }

        requestpage
        {
            layout
            {
                area(content)
                {
                    group(GroupName)
                    {
                    }
                }
            }
            actions
            {
                area(processing)
                {
                }
            }
        }

        var
            LanguageMgmt: Codeunit Language;
            labelNo: TextConst ENU = 'Number', ESM = 'Numero';
            labelLan: TextConst ENU = 'Language', ESM = 'Lenguaje';


    }
    NOTA: I use TextConst in the example but the same thing happens with the Labels
  • alvaro valbuena. Profile Picture
    30 on at

    good evening. the same thing happens to me in a new Report, copy of 1302. Microsoft has not given an alternative to this?

  • BedrettinQdK Profile Picture
    5 on at

    I have the same Problem.

    There is a new Field in Customer page called "Location code", when i fill it with the Code 'ENU', i expect it to print documents for this customer in english, but it doesnt work for me.

    I have not found a method to change the Language besides setting it manually in the requestpage before printing.

    I hope we find a solution here.

  • Verified answer
    Fernando Jose R Profile Picture
    on at
    It seems that it was a BC bug and it has been fixed with the last update.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,742

#2
YUN ZHU Profile Picture

YUN ZHU 844 Super User 2025 Season 2

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 719 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans