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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Report needs to print in Spanish based on customer language

(2) ShareShare
ReportReport
Posted on by 1,275
Hi Guys,
 
I have a requirement in SSRS report to print it in Spanish language. Now the report is printed in EN-US.
 
The condition is the Spanish language in report should be print based on Customer language. I have almost 20 labels. That I need to translate into Spanish language.
 
Kindly elaborate please how I will achieve this.
 
I analysis this and found that I need to do the below steps:
 
1. Need to create a label file for both EN-US and Spanish but the label Id should be UNIQUE.
 
Contract Class:
 
New Parm method for CustAccount.
 
Controller class:
class MyReportController extends SrsReportRunController
{
    public void run()
    {
        MyReportContract contract = this.parmReportContract().parmRdpContract() as MyReportContract;
        CustTable custTable = CustTable::find(contract.parmCustAccount());

        // How will I pass the csutomer language? Is it required?


    }
}
 
 
DP Class:
 
[SRSReportParameterAttribute(classStr(MyReportContract))]
class MyReportDP extends SRSReportDataProviderBase
{
    MyReportTmp tmpTable;
    MyReportContract contract;

    public void processReport()
    {
        contract = this.parmDataContract() as MyReportContract;

        // Load customer
        CustTable custTable = CustTable::find(contract.parmCustAccount());

        tmpTable.clear();

        // Assign label values
        tmpTable.CustomerNameLabel  = "@LBL001";
        tmpTable.InvoiceDateLabel   = "@LBL002";
        tmpTable.AddressLabel       = "@LBL003";
        ...
        tmpTable.TotalAmountLabel   = "@LBL030";

        tmpTable.insert();
    }
}
VS expression
 
=Fields!CustomerNameLabel.Value
 
Note -  In Controller class, How will I pass the customer language. So that based on customer language the report will the label in Spanish language.
 
Kindly validate please.
Categories:
I have the same question (0)
  • Suggested answer
    Ramesh Kumar Profile Picture
    7,527 Super User 2025 Season 2 on at
    Your SSRS report will render in Spanish or any other supported language based on the customer's language in CustTable. Are you keep the base ERP language as English and just want to create report in Spanish?
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
  • CU05031448-0 Profile Picture
    1,275 on at
    The existing report which is already printed in English now I need to modify the report to print in Spanish .
     
    Kindly go through the code and let me know what changes are required.
     
    Thanks
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    It's a supported scenario.
     
    Don't try to deal with labels in the data provider class. Instead, just use labels in the report as usual. In most cases, labels already exist in the system for both Engligh and Spaning. If necessary, use a custom label file and provide both translations.
     
    In your controller class, use code like this to change the language:
    LanguageId languageId = custTable.languageId();
    
    SrsReportRdlDataContract rdlContract = this.parmReportContract().parmRdlContract();
    rdlContract.parmLanguageId(languageId);
    rdlContract.parmLabelLanguageId(languageId);
  • CU05031448-0 Profile Picture
    1,275 on at
    Thanks Martin for the reply.
     
    As you mentioned I have already created translation for both languages.
     
    For example - 
    EN-US : Date 
    Spanish : Fecha
    Label id: @SCL123
    Like for the others also.
     
    Sure, I will add the code in Controller class as you suggested.
     
    So, the code 
    Rdl.contract.parmLangugeId(languageId);
     
    It will pass the language for the customer.
     
    Rdl.contract.parmLabelLanguageId(languageId);
     
    It will pass the label for that languageId.
     
    I have almost 20 labels. So, which label it will pass.
     
    Kindly elaborate please.
     
     
     
     
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    No, that's not how labels work. In tables, forms and so on (including reports), you use the label ID. For example, if you want a table field called Date in UI, you can set its Label property to @SYS80056. (Or, if you really insist, you can duplicate the label as @SCL123, but why doing work that isn't needed?) In an SSRS report, you can refer to labels by =Labels!@SYS80056. Note that you don't typically need to type it on your own - you define labels for table fields and the system uses them when you add fields from a report data sources.
     
    Then you tell the system which language should be used. It takes the label ID (such as @SYS80056) and finds the translation for the given language.
     
    The language is typically controlled by user settings, but as I showed you, you can set a language of a report in code.
     
    Now when you look at my code, notice that I'm passing a language ID to rdlContract.parmLabelLanguageId(). Your understanding of the code isn't correct; it doesn't mean that "It will pass the label for that languageId". It passes a language ID to the report, this language ID will be used to find texts for label IDs defined in the report design.
  • CU05031448-0 Profile Picture
    1,275 on at
    Thanks Martin, Now I understood.
     
    the code- 
    Rdl.contract(),parmLabelLanguageId(LanguageId)
    is enough to translate all labels based on Customer language..
     
    Just we need to reference the label Ids directly to the report design using expression in VS.
     
    Am I correct?
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    That's correct. Note that you can look at examples in the standard applications. All reports use labels and you can use "Find references" to see where methods like parmLabelLanguageId() are used.
  • CU05031448-0 Profile Picture
    1,275 on at
    Sure Martin, thanks

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

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans