问题
Greetings, In my reporting services I would like to add sorting. Is there any way I can add sorting by two fields inside one column's sort expression? something like:
=Fields!SomeValue1.Value
=Fields!Somevalue2.Value
when I use this sort expression, values are not sorted correctly. Values I would like to sort are something like
SomeValue1 SomeValue2
10 11
9 1
20 21
13 12
13 7
17 6
The case is that SomeValue1 and SomeValue2 comes from another value that as follows:
10-11
9-1
20-21
13-12
13-7
17-6
Any help would be appreciated.
回答1:
I can think of three possiblities:
- (Simplest) Include an
order by SomeValue1, SomeValue2
clause at the end of your SQL query. - Sort by two expressions in Table Properties - ie. in the Sorting tab in the Table Properties dialog, enter
=Fields!SomeValue1.Value
as the expression on the first line, then click on the line below and enter=Fields!SomeValue2.Value
- like so: - (Hardest) Sort on a single expression in Table Properties consisting of SomeValue1 and SomeValue2 converted to 0-padded, fixed length strings, concatenated together - similar to the original value, but formatted consistently, like so:
0000000001-0000000001
.
I recommend the first approach.
来源:https://stackoverflow.com/questions/3706732/reporting-services-sort-expression