Hitachi Vantara Pentaho Community Forums
Results 1 to 10 of 10

Thread: how to set locale for report in pentaho server

  1. #1
    Join Date
    Nov 2006
    Posts
    171

    Unhappy how to set locale for report in pentaho server

    Hi,

    I have a report created with the report designer.
    In the preview it displays correctly the decimal sign as comma. There is a property "Default Locale" in the Report element which is set to es_ES.

    But once published to the server, the decimal sign appears as point, although I have the context parameters locale-language and -country in the web.xml of the pentaho.war application set to es and ES. The machine has a Spanish OS.
    I can't find any locale property in the report xml definition.

    I don't know if this is related to the problem, but on startup of the preconfigured jboss installation I get
    09:10:53,329 ERROR [LocaleUtils] Locale name null or empty, ignoring

    I use version 1.2.0 of Pentaho and 1.2.0 RC1 of report designer.

    Thanks in advance,
    Ulrich

  2. #2
    Join Date
    Oct 2005
    Posts
    94

    Default

    If you are viewing reports via the web, the locale is driven from the browser. What is your browser set to?

    Kurtis

  3. #3
    Join Date
    Nov 2006
    Posts
    171

    Default

    I view it in pdf and email body, both appear with . instead of , as decimal sign.
    The email client is Spanish.

    In xls it appears correctly as ,

    Thanks,
    Ulrich

  4. #4
    Join Date
    Nov 2006
    Posts
    171

    Default

    by the way, do you know why I get this jBoss error on startup?

    09:10:53,329 ERROR [LocaleUtils] Locale name null or empty, ignoring

    How do you set the "Locale name" for the PCI?

    Ulrich

  5. #5
    Join Date
    Nov 2006
    Posts
    171

    Default

    Now I understand. The action is triggered by a URL in a browser. The browser transmits the language in the http header. Pentaho takes it and uses it for the number formatting. If I change the language setting of the browser, the report is different. Wow!

    This is fine. But just for curiosity, is there a way to force the locale for the report in the action or the report itself?

    Thanks,
    Ulrich

  6. #6
    Join Date
    Jun 2005
    Posts
    144

    Default Yes. How to do this manually?

    Quote Originally Posted by ulrich View Post
    Now I understand. The action is triggered by a URL in a browser. The browser transmits the language in the http header.
    This is fine. But just for curiosity, is there a way to force the locale for the report in the action or the report itself?
    Anyone know how to do this manually?

  7. #7
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    The report engine gets the locale from a call to "LocaleHelper.getLocale()" (indirectly over the PentahoResourceBundleFactory class, which is part of the Pentaho-Platform). For the report-engine it is defined that the engine will always use the locale from a ResourceBundleFactory-implementation to perform any locale specific task.

    So the real question is: How do you convince the Pentaho-Platform and its LocaleHelper class to return *your* locale. As I cant find any real extension point in the Platform for doing this, I guess you have to resort to Hacking. The LocaleHelper has static methods, so by inserting a JavaScript-Snippet into the XAction somewhere before the reporting starts, you should be able to override the Locale. Not a clean solution, but quoting Marc Batchelor: "..., but it works".
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  8. #8

    Default

    Do you have an example of how to override the locale in javascript in the xaction? I need the locale to be a parameter on my reports but I don't know the correct syntax to change it in the Javascript.

    Thanks

  9. #9

    Default

    Hi,

    My problem is a bit different but may bring some light.

    I have xactions which make up to 380 pdf reports, some of them create 260, and some just 10.
    I use firefox with the 'locale switcher', which seems to work fine.

    My clients are from USA and France, so when I create reports for France I switch my machine locale to France (can customize number, date formats, but I get machine's France default), and switch the Firefox to 'France'. Similar issue with USA clients.

    The funny thing is that when I throw one of the big xactions (above 50 reports approx) then the first ones are perfect, but at some moment, report numbers switch to my country locale (Spain's one).

    I'm talking about the thousand separator and decimal one, just to remind you:

    USA: ##,###.00
    France: ## ###.00
    Spain (at least): ##.###,00

    I thought that maybe I had set some data-format at prd3.5, but it's not the problem.

    This behaviour is driving me mad, how is it possible that some of then are correctly made and other do not during the same xaction execution??

    I'm completely lost with that issue, and my current workaround includes dividing xaction queries by parts. So I'm transforming myself into a "Lost" actor, constantly having to "push the key".

    Edit: I've just tried the solution which consists on changing the locale via xaction (see http://forums.pentaho.org/showthread...ghlight=locale)
    , and on firsty execution, the number format began to fail at 57th item (of a total of 380).


    Thanx in advance
    Last edited by hberges; 02-13-2010 at 02:04 PM. Reason: Adding more info

  10. #10

    Default Solved

    Hi,

    I finally got it working by using the solution mentioned here:
    http://forums.pentaho.org/showthread.php?t=67377

    I had to include the javascript step inside loop to get it work on long xaction executions.
    Last edited by hberges; 02-19-2010 at 07:27 PM. Reason: + info

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.