change query depending on locale [solved] [message #1223515] |
Mon, 23 December 2013 16:21 |
José Litux Messages: 52 Registered: March 2013 |
Member |
|
|
Hi
I'm trying to modify the SQL query for a Chart depending on the locale. What I get so far :
beforeFactory
var mylocale=reportContext.getLocale().toString().substr(1,2)
But I'm stuck on retrieving the parameter and inserting on the query. Something like this:
Select * from table where country=' + param["mylocale"] + '
Any help would be much appreciated
[Updated on: Fri, 07 February 2014 17:53] Report message to a moderator
|
|
|
|
|
Re: change query depending on locale [message #1240557] |
Thu, 06 February 2014 19:07 |
José Litux Messages: 52 Registered: March 2013 |
Member |
|
|
Hi donino
i'm afraid I gave a wrong example.
The real query is more a thing like this:
If locale is French, select French_name, french_description from product
If locale is English, select englîsh_name, english_description from product
I can get the locale but I'm stuck on getting the proper SQL to work in the dataset
Thanks in advance
[Updated on: Thu, 06 February 2014 20:58] Report message to a moderator
|
|
|
Re: change query depending on locale [message #1240983 is a reply to message #1240557] |
Fri, 07 February 2014 09:50 |
donino donino Messages: 183 Registered: July 2011 |
Senior Member |
|
|
In this case you need to change your query depending on the value of the locale. In the beforeOpen script of the dataset. You probably need to use aliases so that BIRT can still match columns dataset with the result of the query. It would be something like:
var mylocale=reportContext.getLocale().toString().substr(1,2);
if (mylocale=="fr"){
this.queryText="select French_name as name, french_description as description from product";
}else if(mylocale=="en"){
this.queryText="select englîsh_name as name, english_description as description from product";
}
Let me know if it helps
[Updated on: Fri, 07 February 2014 09:54] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02381 seconds