Conditional Sorting
During report runtime, I'm having one minor issue. We want to have this report sort its details by a field only if another field is equal to 3.00000, and to not bother with sorting by the field if the original field isnt equal to 3.00000.
The problem in SSRS is, it wont let me do the following
Iif(total = 3.00000, ValueIWantToSortBy, 3)
where 3 would be the final thing to sort by, as a placeholder since i cant just say, if total = 3.00000, sort by this, even though it's what i want.
Can anyone assist on how to go about doing a conditional sort like this?
Thanks
February 21st, 2012 3:34pm
bamp, to the top, anyone?
or in general, my rows arent getting sorted by ValueIWantToSortBy when its first in my list...
Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2012 10:31am
Hi TheTurdFerguson,
I am assuming that you want to sort the details inside a particular group and the "total" is the aggregated value of the field for that group. So the condition which should be mentioned on the Sorting for that group would be
IIF(SUM(Field1.Value,"GroupScope") = 3, Field2.Value, Nothing) --> Scope is important to be specified for the condition
If you are planning to sort the whole report rather than individual groups, then the sorting is best some value not belonging to any of the fields in the report details, lets say a parameter. So the condition would be something like
IIF(Parameter1.Value = 3, Field2.Value, Nothing).
Hope I am not wrong in my understanding.
Regards
Manoj
~Mark as Answer if found correct
February 22nd, 2012 10:53am
Hi TheTurdFerguson,
To control the sort order of data in a data region when a report first runs, we must set the sort expression on the data region or group. We can also write an expression define custom sorting for the data region or group.
There are some related threads about customize sorting for your reference, please see:
Sorting dynamic columns:
http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/915c0c61-df90-4e1c-a012-33ff0e62d083
Sort order for series group in Column chart:
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/1c8238f0-a083-42b8-8d3d-ebaa51db30ab
If this does not meet you requirement, please post an example and elaborate the requirement with more detail.
Regards,
Bin LongBin Long
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
February 23rd, 2012 3:49am