AGuyCalledGerald
AGuyCalledGerald

Reputation: 8150

Sort table by parameter (Reporting Services 2008)

In Reporting Services 2008, I would like to sort a table by the use of a parameter. The table has fields MainCategory and SubCategory. My parameter is called SortCriterion and has two labels, "Main Category" and "Sub Category". The sortexpression of the table should then be

=Parameters!SortCriterion.Value

But I do not know what to insert as value for the parameters. Naively, I tried

Fields!MainCategory.Value

and

Fields!SubCategory.Value

but it doesn´t work. Is it possible and how?

Upvotes: 1

Views: 4708

Answers (1)

Jamie F
Jamie F

Reputation: 23809

Try setting the Sort Expression of the table to:

=IIF(Parameters!SortCriterion.Value = "Main Category",
  Fields!MainCategory.Value,
  Fields!SubCategory.Value)

If this doesn't give you the results you want then please give an example of what sorting you are after.

Upvotes: 3

Related Questions