简体   繁体   中英

Tablix in SSRS 2008

I use a tablix in SSRS 2008 with a Region name and it may contain 10 different regions. Currently, the regions are sorted in the code alphabetically but I have to sort them differently, so I assigned a number to each in the CASE statment based on the desired order. I then sorted the regions by the required order in the tablix itself and the regions are sorted in the desired order in the report but unfortunately, the number assigned is in the report instead of the region name. Instead of getting

BF CF CO CL etc…. I get

1 2 3 4 etc in the heading of the report.

any help will be greatly appreciated.

CASE , 
WHEN teamgroup.Name = 'BF' THEN 1
WHEN teamgroup.Name = 'CF' THEN 2
WHEN teamgroup.Name = 'CO' THEN 3
WHEN teamgroup.Name = 'CL' THEN 4
WHEN teamgroup.Name = 'CN' THEN 5
WHEN teamgroup.Name = 'GA' THEN 6
WHEN teamgroup.Name = 'IN' THEN 7
WHEN teamgroup.Name = 'KY' THEN 8
WHEN teamgroup.Name = 'MD' THEN 9
WHEN teamgroup.Name = 'NF' THEN 10
END AS Region

You still need to have teamgroup.Name as a column in your resultset, in addition to your sort column. Do this instead:

teamgroup.Name AS Region,
CASE
...
END AS Region_Sort

And then in your SSRS, add the Region column to your Tablix. In the sorting properties for the table, use Region_Sort . Make sure not to add Region_Sort to your Tablix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM