Skip to main content



      Home
Home » Archived » 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 05:28 Go to next message
Eclipse UserFriend
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 05:22] by Moderator

Re: Get a text from property file in dataset binding [message #922196 is a reply to message #921618] Mon, 24 September 2012 16:40 Go to previous messageGo to next message
Eclipse UserFriend
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 05:21 Go to previous message
Eclipse UserFriend
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 Jul 25 01:03:43 EDT 2025

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

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

Back to the top