wmolzahn Posted March 21, 2011 Share Posted March 21, 2011 Hi,I'm working with iReport 4.0.0 and jasperreports 4.0.0 and I have the problem that language-switching due to REPORT_LOCALE does not work. Nevertheless what I fill in that parameter - the result is always the same: jasperreport uses the default-locale of my system. The report works as desired if I switch the locale of my windows-pc - but the parameter is always ignored. Does anyone know this problem - can anyone help me ??Wilfried Link to comment Share on other sites More sharing options...
mdahlman Posted March 21, 2011 Share Posted March 21, 2011 Wilfried,If you want to test a report in an alternate locale in iReport, you should bring up the iReport preferences and find the tab "Compilation and execution". In the subtab "Execution options" you can see "Report Locale". Set this, and you should get what you want.Regards,Matt Link to comment Share on other sites More sharing options...
wmolzahn Posted March 22, 2011 Author Share Posted March 22, 2011 Hi Matt,I want to start my report now without iReport (see code below). And I want to to put the REPORT_LOCALE parameter into the report. I added an additional test-output ($P{REPORT_LOCALE}.toString( ))in the report in order to see whether the arriving parameter value is corresponding to the sending value - and it is!! I can change the REPORT_LOCALE value - but my report does not handle it!! My report always uses the property file according to my system default. It seems that the runtime environment does not evaluate the parameter correctly ??!!Can you help me please?WilfriedCode: void executeReportJrxml(String name) throws SQLException { // Datenbank Connection conn = null; try { conn = DriverManager.getConnection("jdbc:oracle:thin:@...", "...", "..."); } catch (SQLException sqle) { ErrorHandler.handle(BaseLibErrorCodes.ERR_COMMON_ERROR, "Cannot connect to DB", sqle); } JasperPrint printout = null; try { // compilierten Report erzeugen InputStream strm = TimeScheduleChartCustomizer.class.getResourceAsStream(name + ".jrxml"); if (strm == null) { ErrorHandler.handle(BaseLibErrorCodes.ERR_COMMON_ERROR, "Could not find report" + name + ".jrxml"); return; } JasperReport report = JasperCompileManager.compileReport(strm); // Parameter festlegen und den Report ausfüllen parameters.put(JRParameter.REPORT_LOCALE, new Locale("en", "US")); parameters.put("REPORT_TIMEZONE", sessionUser.getTimezone()); parameters.put("SUBREPORT_DIR", "com/eon/aim/reports/"); parameters.put("REPORT_USER", sessionUser.getName()); parameters.put("REPORT_USERPARAM_01", "70748,1270345,770382"); parameters.put("REPORT_USERPARAM_02", Timestamp.valueOf("2010-01-01 00:00:00")); printout = JasperFillManager.fillReport(report, parameters, conn); } catch (JRException jre) { ErrorHandler.handle(BaseLibErrorCodes.ERR_COMMON_ERROR, "Problems with JasperReport", jre); } finally { conn.close(); } // und ausgeben JasperViewer.viewReport(printout); }} Link to comment Share on other sites More sharing options...
mdahlman Posted March 22, 2011 Share Posted March 22, 2011 Wilfried,If your question is not an iReport question, then you'll get better answers on a different forum.JasperReports Server has the ability to run the report with any specified locale. You should be able to find what's needed by reviewing that code. (Or just use JasperReports Server!)Good luck,Matt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now