Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Group sort order based on report parameter
joo
Hi everyone,
I have a table that is grouped by a particular column. Based on a report parameter I would like this group to be sorted in ascending or descending order. At the moment I have implemented this as follows
1. Declare a report parameter
2. Declare 2 group sets, one sorted in ascending order and the other sorted in descending. Both groups will group records based on the same column
3. In the visibility tab of the group use the following script
if (params["group_sort_direction"].value=='ascending')
{
true
}
false
Depending on the group in question the 'ascending' and 'descending' comparison would change. Here group_sort_direction is the report parameter name.
This solution does not seem to work. I get 2 group headings in my report when I run the preview. The idea was to make one group invisible based on the report parameter that the user enters.
Is the approach I am using correct or is there a simple way to mention the group's sort order through a script ? Something like groupName.sortOrder='ascending'. I tried searching / googling for the same and did not find anything, which is why I tried the odd looking solution approach described above.
Let me know what you think. Thanks
Find more posts tagged with
Comments
magic_bern
Hi Joo,
I remember having some problem with visibility when i used two different things in the same table.
What i would do in your case is have the exact same table twice with each just one of that column you like to sort by.
i would then use the visibility criteria you have to hide one or the other table depending on whether it is ascending or descending.
and since u don get a gap on the report when the table is hiden it should still ok.
I hope that made some sense..
joo
Yes that did make sense. However dont you guys think that duplicating the table twice is quite inefficient ? I agree that the solution will probably work but if the table needs a change, it will have to be done correctly in 2 places.
I will give the duplicate solutions a try. If there is a better one do let me know. Thank you for your time
magic_bern
Yeah Joo,
I agree with you that it may not be very efficient with two table but i am also relatively new to Birt hence the basic solution.
I think if you want it in one table with just the colum changing, then you might need to make sure that you can get both grouping method from the same dataset.. but i cant quite tell you how to do that...
hope you get the desired output.
Berny