Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » [Solved] Get a text from property file in dataset binding
icon5.gif  [Solved] Get a text from property file in dataset binding [message #921618] Mon, 24 September 2012 09:28 Go to next message
Blaine Mising name is currently offline Blaine Mising nameFriend
Messages: 25
Registered: December 2010
Junior Member
Is it possible to get a text from a property file in a databinding?
My report must show texts in multiple languages and values in the database are always in english, then I need to get from the property file the text.

For example:

if(dataSetRow["FIELD"]== "Description"){

"Description" //How to get the value of "description" property and shows it instead datasetrow value
}
else if(dataSetRow["FIELD"] == "Price"{

"price" //How to get the value of "description" property and shows it instead row value
}

How can I do it?

I tried with reportContext.getParameterValue("Description") but it doesn't work.


[Updated on: Tue, 25 September 2012 09:22]

Report message to a moderator

Re: Get a text from property file in dataset binding [message #922196 is a reply to message #921618] Mon, 24 September 2012 20:40 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Probably the best way to do this is to create message files and put them in the resource folder. Then if you are using a label report item you can add an onCreate script like:

var key = this.getRowData().getColumnValue("BINDINGNAME"); //where BINDINGNAME is the name in the binding tab
this.text = reportContext.getMessage(key, reportContext.getLocale());
Note that you have to add the message files to the report in the general properties resources tab for the report. You can also set the key directly without code in the label localization property in the properties view.
In the example you posted you could also alter it from:
if(dataSetRow["FIELD"]== "Description"){
reportContext.getMessage(dataSetRow["FIELD"], reportContext.getLocale());
}

Jason
Re: Get a text from property file in dataset binding [message #922731 is a reply to message #921618] Tue, 25 September 2012 09:21 Go to previous message
Blaine Mising name is currently offline Blaine Mising nameFriend
Messages: 25
Registered: December 2010
Junior Member
Thanks for your help.

It works fine!!
Previous Topic:problem with output parameters
Next Topic:Masterpage orientation = landscape. Report prints and exports in portrait
Goto Forum:
  


Current Time: Fri Dec 19 14:25:40 GMT 2014

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

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