Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » localize dataset value(localize (localise) a dataset value)
localize dataset value [message #813219] Mon, 05 March 2012 01:34 Go to next message
Anthony Farrell is currently offline Anthony Farrell
Messages: 25
Registered: April 2011
Location: Ireland
Junior Member
I have a urgent question ,e.g.

If the sudo SQL in the data set was something like (i.e. it generated derived data)

select case (age > 55 then 'Old' else 'young') from person

I would need to localise the values 'old ' and 'young', how would we do this ?

I would like to use the same property files used to localize the report title, chart xaxis title ...etc

Is it possible to some-how map the sql data values that comes back from a column in a SQL query to a property name in a localized text file ?

Can I create a map or rule of some kind to "'old' maps to key "report.age.old=Old"


Many thanks.
Anthony.
Re: localize dataset value [message #813942 is a reply to message #813219] Mon, 05 March 2012 21:43 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You could always add a computed column to the dataset that has an
expression similar to:

reportContext.getMessage(row["YOURCOLUMNNAME"]);

As long as the value of YOURCOLUMNAME is in a resource file associated
with the report it should convert it for you.

Jason

On 3/4/2012 8:34 PM, Anthony Farrell wrote:
> I have a urgent question ,e.g.
>
> If the sudo SQL in the data set was something like (i.e. it generated
> derived data)
>
> select case (age > 55 then 'Old' else 'young') from person
>
> I would need to localise the values 'old ' and 'young', how would we do
> this ?
>
> I would like to use the same property files used to localize the report
> title, chart xaxis title ...etc
> Is it possible to some-how map the sql data values that comes back from
> a column in a SQL query to a property name in a localized text file ?
>
> Can I create a map or rule of some kind to "'old' maps to key
> "report.age.old=Old"
>
>
> Many thanks.
> Anthony.
Re: localize dataset value [message #813978 is a reply to message #813942] Mon, 05 March 2012 22:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

You can also use that same code in an oncreate of the data element like:

this.setDisplayValue(reportContext.getMessage(this.getValue());

Jason

On 3/5/2012 4:43 PM, Jason Weathersby wrote:
> You could always add a computed column to the dataset that has an
> expression similar to:
>
> reportContext.getMessage(row["YOURCOLUMNNAME"]);
>
> As long as the value of YOURCOLUMNAME is in a resource file associated
> with the report it should convert it for you.
>
> Jason
>
> On 3/4/2012 8:34 PM, Anthony Farrell wrote:
>> I have a urgent question ,e.g.
>>
>> If the sudo SQL in the data set was something like (i.e. it generated
>> derived data)
>>
>> select case (age > 55 then 'Old' else 'young') from person
>>
>> I would need to localise the values 'old ' and 'young', how would we do
>> this ?
>>
>> I would like to use the same property files used to localize the report
>> title, chart xaxis title ...etc
>> Is it possible to some-how map the sql data values that comes back from
>> a column in a SQL query to a property name in a localized text file ?
>>
>> Can I create a map or rule of some kind to "'old' maps to key
>> "report.age.old=Old"
>>
>>
>> Many thanks.
>> Anthony.
>
Re: localize dataset value [message #814747 is a reply to message #813978] Tue, 06 March 2012 21:04 Go to previous messageGo to next message
Anthony Farrell is currently offline Anthony Farrell
Messages: 25
Registered: April 2011
Location: Ireland
Junior Member
Many thanks for your prompt reply, we will go with the computed column approach :

reportContext.getMessage(row["CASESTATUS"]);

All you need are property values for each CASESTATUS value,e.g. if there were only 2 case status then the property file would only need
open=Open Status
close=Close Status

with a property localised to French containing:
open=Open in french
closed=close in french.
Re: localize dataset value [message #815482 is a reply to message #814747] Wed, 07 March 2012 18:16 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

That is correct.

Jason

On 3/6/2012 4:04 PM, Anthony Farrell wrote:
> Many thanks for your prompt reply, we will go with the computed column
> approach :
>
> reportContext.getMessage(row["CASESTATUS"]);
>
> All you need are property values for each CASESTATUS value,e.g. if there
> were only 2 case status then the property file would only need open=Open
> Status
> close=Close Status
>
> with a property localised to French containing:
> open=Open in french
> closed=close in french.
Previous Topic:pageNumber variable does not seem to work correctly
Next Topic:How to do like this style.
Goto Forum:
  


Current Time: Tue Sep 16 13:38:39 GMT 2014

Powered by FUDForum. Page generated in 0.03101 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software