String sorting and Locale problem [message #500664] |
Fri, 27 November 2009 11:42 |
Eclipse User |
|
|
|
Originally posted by: bdraba.gmail.com
Hello,
What I need to set to have properly (in locale different than English)
sorted column of strings data in the table?
Thanks!
Bartek
|
|
|
Re: String sorting and Locale problem [message #500949 is a reply to message #500664] |
Mon, 30 November 2009 12:14 |
Eclipse User |
|
|
|
Originally posted by: bdraba.gmail.com
Hi again,
Maybe I wasn't clear enough. I want to sort column of strings in my table
and BIRT sorts it in natural order in English alphabet
but I need to do this in other language (alphabet).
The question is what and where set my Locale (or other properties) to make
BIRT sorting in my Language.
Thanks a lot,
Bartek
> Hello,
>
> What I need to set to have properly (in locale different than English)
> sorted column of strings data in the table?
>
> Thanks!
> Bartek
>
>
|
|
|
Re: String sorting and Locale problem [message #500984 is a reply to message #500949] |
Mon, 30 November 2009 15:16 |
|
Are you adding &__locale=yourlocale to the report url?
Two other things you can do:
1 - Build a custom sort order by entering an expression for the key.
For example assume I sort on orderlinenumber and I want to sort it like
3
1
2
4
I could enter this expression:
var ol = row["ORDERLINENUMBER"];
if( ol == 3 ){
1
}else if( ol == 1 ){
2
}else if( ol == 2 ){
3
}else if( ol == 4 ){
4
}
2 - Try adding the sort key in the beforeFactory script of the report.
importPackage(Packages.org.eclipse.birt.report.model.api);
importPackage(Packages.org.eclipse.birt.report.model.api.ele ments);
importPackage(Packages.com.ibm.icu.util);
var lc = new ULocale("fr_FR");
delm = reportContext.getDesignHandle().findElement("mytable");
sc = StructureFactory.createSortKey();
sc.setKey("row[\"ORDERNUMBER\"]");
sc.setDirection("desc");
sc.setLocale(lc);
ph = delm.getPropertyHandle(TableHandle.SORT_PROP);
ph.addItem(sc);
notice the ULocale object. The sort key has a setLocale method. I have
not tried this but its worth a try.
Jason
drabek wrote:
> Hi again,
>
> Maybe I wasn't clear enough. I want to sort column of strings in my table
> and BIRT sorts it in natural order in English alphabet
> but I need to do this in other language (alphabet).
> The question is what and where set my Locale (or other properties) to make
> BIRT sorting in my Language.
>
> Thanks a lot,
> Bartek
>
>> Hello,
>>
>> What I need to set to have properly (in locale different than English)
>> sorted column of strings data in the table?
>>
>> Thanks!
>> Bartek
>>
>>
>
>
|
|
|
Re: String sorting and Locale problem [message #502435 is a reply to message #500984] |
Tue, 08 December 2009 08:58 |
Eclipse User |
|
|
|
Originally posted by: maciej.dot.kruk.alan-systems.dot.com
hi,
no way:
> importPackage(Packages.org.eclipse.birt.report.model.api);
> importPackage(Packages.org.eclipse.birt.report.model.api.ele ments);
> importPackage(Packages.com.ibm.icu.util);
>
> var lc = new ULocale("fr_FR");
> delm = reportContext.getDesignHandle().findElement("mytable");
> sc = StructureFactory.createSortKey();
> sc.setKey("row[\"ORDERNUMBER\"]");
> sc.setDirection("desc");
> sc.setLocale(lc);
>
> ph = delm.getPropertyHandle(TableHandle.SORT_PROP);
> ph.addItem(sc);
>
>
> notice the ULocale object. The sort key has a setLocale method. I have
> not tried this but its worth a try.
No, org.eclipse.birt.report.model.api.elements.structures.SortKe y does not
have the setLocale method.
Actually, BIRT is able only to sort the data binary or not. Don't think of
use java.text.Collator strengths or any kind of it!
The lack of this feature disqualifies BIRT to use in multilingual
applications, doesn't it?
Maciek
|
|
|
Re: String sorting and Locale problem [message #502562 is a reply to message #502435] |
Tue, 08 December 2009 20:02 |
|
Maciek,
What version of BIRT are you using?
2.5.1
org.eclipse.birt.report.model.api.elements.structures.SortKe y does have
a setLocale method, which the SortKeyHandle uses. There is also a
setStrength method. The data engine uses com.ibm.icu.text.Collator. If
this is not functioning right a bug will need to be logged.
Can you try this:
importPackage(Packages.org.eclipse.birt.report.model.api);
importPackage(Packages.org.eclipse.birt.report.model.api.ele ments);
importPackage(Packages.com.ibm.icu.util);
importPackage(Packages.org.eclipse.birt.data.engine.api);
var lc = new ULocale("fr_FR");
delm = reportContext.getDesignHandle().findElement("mytable");
sc = StructureFactory.createSortKey();
sc.setKey("row[\"ORDERNUMBER\"]");
sc.setDirection("desc");
sc.setLocale(lc);
//ASCII_SORT_STRENGTH or DEFAULT_SORT_STRENGTH for Collator
sc.setStrength( ISortDefinition.DEFAULT_SORT_STRENGTH );
ph = delm.getPropertyHandle(TableHandle.SORT_PROP);
ph.addItem(sc);
Jason
Maciej Kruk wrote:
> hi,
> no way:
>
>> importPackage(Packages.org.eclipse.birt.report.model.api);
>> importPackage(Packages.org.eclipse.birt.report.model.api.ele ments);
>> importPackage(Packages.com.ibm.icu.util);
>>
>> var lc = new ULocale("fr_FR");
>> delm = reportContext.getDesignHandle().findElement("mytable");
>> sc = StructureFactory.createSortKey();
>> sc.setKey("row[\"ORDERNUMBER\"]");
>> sc.setDirection("desc");
>> sc.setLocale(lc);
>>
>> ph = delm.getPropertyHandle(TableHandle.SORT_PROP);
>> ph.addItem(sc);
>>
>>
>> notice the ULocale object. The sort key has a setLocale method. I have
>> not tried this but its worth a try.
>
> No, org.eclipse.birt.report.model.api.elements.structures.SortKe y does not
> have the setLocale method.
>
> Actually, BIRT is able only to sort the data binary or not. Don't think of
> use java.text.Collator strengths or any kind of it!
> The lack of this feature disqualifies BIRT to use in multilingual
> applications, doesn't it?
>
> Maciek
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03994 seconds