Skip to main content



      Home
Home » Archived » BIRT » Sorting Woes
Sorting Woes [message #164378] Wed, 24 May 2006 15:56 Go to next message
Eclipse UserFriend
I have a report where I create a group by 4 different collumns. To acheive
this, I just make the groupID
row["column1"]+row["column2"]+row["column3"]+row["column4 "].

Unfortunately, this messes up my sorting, because two of the columns are
integer values, and two of them are varchar values. Since the group is
always sorted ascending or descending, this messes up the sort order that I
already specified in the query.

Does anyone have any ideas how I can group by all four of these columns, but
sort them by their original data types?
Re: Sorting Woes [message #164483 is a reply to message #164378] Wed, 24 May 2006 20:43 Go to previous messageGo to next message
Eclipse UserFriend
Have you tried using the sorting tab in the group wizard and add a key for
each of your individual values?
The sorting should work similar to your last post on sorting but will be
applied to the group.

Jason

"floor" <floorflux@hotmail.com> wrote in message
news:e52dvm$ot9$1@utils.eclipse.org...
>I have a report where I create a group by 4 different collumns. To acheive
>this, I just make the groupID
>row["column1"]+row["column2"]+row["column3"]+row["column4 "].
>
> Unfortunately, this messes up my sorting, because two of the columns are
> integer values, and two of them are varchar values. Since the group is
> always sorted ascending or descending, this messes up the sort order that
> I already specified in the query.
>
> Does anyone have any ideas how I can group by all four of these columns,
> but sort them by their original data types?
>
Re: Sorting Woes [message #164651 is a reply to message #164483] Thu, 25 May 2006 10:50 Go to previous messageGo to next message
Eclipse UserFriend
Jason,

I have added sort keys in the group details for all 4 of the columns. I
added them in what would seem to be reverse order, because it seems like the
lowest key in the sort key table has the highest precedence. With this
configuration, I'm still having errors in sorting. For example, I'm
getting:

34 S 10 E
34 S 14 E
34 S 22 E
34 S 23 E
34 S 9 E

If it's truly sorting by the integer fields, the last row should actually be
the first.

To be more specific, the column with the 34s is set as the primary sort key
(bottom in the list) and the column with second integers is set as the
secondary sort key. I removed the varchar stuff from the sorting to
simplify the problem, since I can't even the the numeric ones to work
correctly.

--floor


"Jason Weathersby" <jweathersby@actuate.com> wrote in message
news:e52uiv$ral$1@utils.eclipse.org...
> Have you tried using the sorting tab in the group wizard and add a key for
> each of your individual values?
> The sorting should work similar to your last post on sorting but will be
> applied to the group.
>
> Jason
>
> "floor" <floorflux@hotmail.com> wrote in message
> news:e52dvm$ot9$1@utils.eclipse.org...
>>I have a report where I create a group by 4 different collumns. To
>>acheive this, I just make the groupID
>>row["column1"]+row["column2"]+row["column3"]+row["column4 "].
>>
>> Unfortunately, this messes up my sorting, because two of the columns are
>> integer values, and two of them are varchar values. Since the group is
>> always sorted ascending or descending, this messes up the sort order that
>> I already specified in the query.
>>
>> Does anyone have any ideas how I can group by all four of these columns,
>> but sort them by their original data types?
>>
>
>
Re: Sorting Woes [message #164691 is a reply to message #164651] Thu, 25 May 2006 12:52 Go to previous message
Eclipse UserFriend
There may be a bug in the sorter for groups. It appears to only use the
group key in the sorter.
To get around this problem you could nest groups and remove the headers.
Take a look at the attached example.
You could also try putting the sorter on the table.

Right click on the table and select edit groups.

Jason

<?xml version="1.0" encoding="UTF-8"?>

<!-- Written by Eclipse BIRT 2.0 -->

<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.2"
id="1">

<property name="createdBy">Eclipse BIRT Designer Version
2.1.0.N20060430-1302 Build &lt;20060430-1302></property>

<property name="units">in</property>

<property name="comments">Copyright (c) 2006 Actuate Corporation.</property>

<data-sources>

<script-data-source name="Data Source" id="4"/>

</data-sources>

<data-sets>

<script-data-set name="Data Set" id="5">

<list-property name="resultSet">

<structure>

<property name="position">1</property>

<property name="name">int1</property>

<property name="dataType">integer</property>

</structure>

<structure>

<property name="position">2</property>

<property name="name">str1</property>

<property name="dataType">string</property>

</structure>

<structure>

<property name="position">3</property>

<property name="name">int2</property>

<property name="dataType">integer</property>

</structure>

<structure>

<property name="position">4</property>

<property name="name">str2</property>

<property name="dataType">string</property>

</structure>

</list-property>

<list-property name="columnHints">

<structure>

<property name="columnName">int1</property>

</structure>

<structure>

<property name="columnName">str1</property>

</structure>

<structure>

<property name="columnName">int2</property>

</structure>

<structure>

<property name="columnName">str2</property>

</structure>

</list-property>

<structure name="cachedMetaData">

<list-property name="resultSet">

<structure>

<property name="position">1</property>

<property name="name">int1</property>

<property name="dataType">integer</property>

</structure>

<structure>

<property name="position">2</property>

<property name="name">str1</property>

<property name="dataType">string</property>

</structure>

<structure>

<property name="position">3</property>

<property name="name">int2</property>

<property name="dataType">integer</property>

</structure>

<structure>

<property name="position">4</property>

<property name="name">str2</property>

<property name="dataType">string</property>

</structure>

</list-property>

</structure>

<property name="dataSource">Data Source</property>

<method name="open"><![CDATA[i=0;]]></method>

<method name="fetch"><![CDATA[if (i>5){


return false;


}else{




if( i == 0 ){


row["int1"] = 34 ;

row["int2"] = 10;

row["str1"] = "S";

row["str2"] = "E";


}


if( i == 1 ){


row["int1"] = 34 ;

row["int2"] = 14;

row["str1"] = "S";

row["str2"] = "E";


}

if( i == 2 ){


row["int1"] = 34 ;

row["int2"] = 22;

row["str1"] = "S";

row["str2"] = "E";


}

if( i == 3 ){


row["int1"] = 34 ;

row["int2"] = 23;

row["str1"] = "S";

row["str2"] = "E";


}

if( i == 4 ){


row["int1"] = 34 ;

row["int2"] = 9;

row["str1"] = "S";

row["str2"] = "E";


}




i++;


return true;


}]]></method>

</script-data-set>

</data-sets>

<page-setup>

<simple-master-page name="Simple MasterPage" id="2">

<page-footer>

<text id="3">

<property name="contentType">html</property>

<text-property name="content"><![CDATA[<value-of>new
Date()</value-of>]]></text-property>

</text>

</page-footer>

</simple-master-page>

</page-setup>

<body>

<table id="29">

<property name="width">100%</property>

<property name="dataSet">Data Set</property>

<list-property name="boundDataColumns">

<structure>

<property name="name">int1</property>

<expression name="expression">dataSetRow["int1"]</expression>

<property name="dataType">integer</property>

</structure>

<structure>

<property name="name">str1</property>

<expression name="expression">dataSetRow["str1"]</expression>

<property name="dataType">string</property>

</structure>

<structure>

<property name="name">int2</property>

<expression name="expression">dataSetRow["int2"]</expression>

<property name="dataType">integer</property>

</structure>

<structure>

<property name="name">str2</property>

<expression name="expression">dataSetRow["str2"]</expression>

<property name="dataType">string</property>

</structure>

</list-property>

<column id="53"/>

<column id="54"/>

<column id="55"/>

<column id="56"/>

<header>

<row id="30">

<cell id="31">

<label id="32">

<text-property name="text">int1</text-property>

</label>

</cell>

<cell id="33">

<label id="34">

<text-property name="text">str1</text-property>

</label>

</cell>

<cell id="35">

<label id="36">

<text-property name="text">int2</text-property>

</label>

</cell>

<cell id="37">

<label id="38">

<text-property name="text">str2</text-property>

</label>

</cell>

</row>

</header>

<group id="57">

<property name="groupName">NewTableGroup1</property>

<property name="interval">none</property>

<property name="sortDirection">asc</property>

<expression name="keyExpr">row["int1"]</expression>

<property name="repeatHeader">true</property>

<property name="hideDetail">false</property>

<property name="pageBreakAfter">auto</property>

<property name="pageBreakBefore">auto</property>

<list-property name="sort">

<structure>

<expression name="key">row["int2"]</expression>

<property name="direction">desc</property>

</structure>

<structure>

<expression name="key">row["int1"]</expression>

</structure>

</list-property>

</group>

<group id="71">

<property name="groupName">NewTableGroup2</property>

<property name="interval">none</property>

<property name="sortDirection">asc</property>

<expression name="keyExpr">row["int2"]</expression>

<property name="repeatHeader">true</property>

<property name="hideDetail">false</property>

<property name="pageBreakAfter">auto</property>

<property name="pageBreakBefore">auto</property>

</group>

<detail>

<row id="39">

<cell id="40">

<data id="41">

<property name="resultSetColumn">int1</property>

</data>

</cell>

<cell id="42">

<data id="43">

<property name="resultSetColumn">str1</property>

</data>

</cell>

<cell id="44">

<data id="45">

<property name="resultSetColumn">int2</property>

</data>

</cell>

<cell id="46">

<data id="47">

<property name="resultSetColumn">str2</property>

</data>

</cell>

</row>

</detail>

<footer>

<row id="48">

<cell id="49"/>

<cell id="50"/>

<cell id="51"/>

<cell id="52"/>

</row>

</footer>

</table>

</body>

</report>

"floor" <floorflux@hotmail.com> wrote in message
news:e54gce$sb$1@utils.eclipse.org...
> Jason,
>
> I have added sort keys in the group details for all 4 of the columns. I
> added them in what would seem to be reverse order, because it seems like
> the lowest key in the sort key table has the highest precedence. With
> this configuration, I'm still having errors in sorting. For example, I'm
> getting:
>
> 34 S 10 E
> 34 S 14 E
> 34 S 22 E
> 34 S 23 E
> 34 S 9 E
>
> If it's truly sorting by the integer fields, the last row should actually
> be the first.
>
> To be more specific, the column with the 34s is set as the primary sort
> key (bottom in the list) and the column with second integers is set as the
> secondary sort key. I removed the varchar stuff from the sorting to
> simplify the problem, since I can't even the the numeric ones to work
> correctly.
>
> --floor
>
>
> "Jason Weathersby" <jweathersby@actuate.com> wrote in message
> news:e52uiv$ral$1@utils.eclipse.org...
>> Have you tried using the sorting tab in the group wizard and add a key
>> for each of your individual values?
>> The sorting should work similar to your last post on sorting but will be
>> applied to the group.
>>
>> Jason
>>
>> "floor" <floorflux@hotmail.com> wrote in message
>> news:e52dvm$ot9$1@utils.eclipse.org...
>>>I have a report where I create a group by 4 different collumns. To
>>>acheive this, I just make the groupID
>>>row["column1"]+row["column2"]+row["column3"]+row["column4 "].
>>>
>>> Unfortunately, this messes up my sorting, because two of the columns are
>>> integer values, and two of them are varchar values. Since the group is
>>> always sorted ascending or descending, this messes up the sort order
>>> that I already specified in the query.
>>>
>>> Does anyone have any ideas how I can group by all four of these columns,
>>> but sort them by their original data types?
>>>
>>
>>
>
>
Previous Topic:Localization: How to switch the key on runtime?
Next Topic:How to render a BIRT Chart on a SWT Canvas -> Example
Goto Forum:
  


Current Time: Thu May 08 22:07:38 EDT 2025

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

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

Back to the top