Groups | Blog | Home
all groups > sql server reporting services > june 2005 >

sql server reporting services : Specific Order Group


itbik
6/24/2005 3:08:03 PM
I hope someone can answer my question. I'm wondering is there a way in RS to
put group items in a specific order. For example, I have a field I group on
and the items are A/B/C/D/E but I want to see the items in this order
D/A/C/B/E. I was able to do this in Crystal Reports and was hoping I could
do it in RS.

Thanks in advance for any help.
Wayne Snyder
6/26/2005 9:03:12 AM
Thats an interesting question, and I haven't tested this, but why not try to
sort the incoming data in the proper order you wish the groups to appear,
then do no sorting in the groups...

the order by in the SQL might be something like

ORDER BY CASE Groupname
When 'D' THen 1
when 'A' then 2
When 'C' then 3
When 'B' Then 4
When 'E' Then 5
Else 6
end

Hope this helps...

--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)

I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org

[quoted text, click to view]

itbik
6/28/2005 9:31:06 AM
Wayne,
Thanks for all the help. I couldn't get the Order By to sort
correctly, but I think it was because of what I was trying to do and my data.
Good news is I did resolve my problem, thanks to your ideal I found
something that works. Probally not the best way, but it is working. I
created an extra field in the select statement to hold the sort number and
then use order by to sort on the new field. The part of the select statement
looks like this;

Select 'Group_Order' =
CASE Groupname
When 'D' THen 1
When 'A' then 2
When 'C' then 3
When 'B' Then 4
When 'E' Then 5
Else 6
end, Groupname, GroupID from test
Order By Group_Order

This worked great for what I'm doing, but if anyone has a different way or
ideal would be glad to hear it.

Again Wayne, Thanks for the help.
Henry

[quoted text, click to view]
AddThis Social Bookmark Button