sorting in ssrs

  • i need to sort my report based on user select value

    for ex,i have parameter sort by

    item1 item2 item3(radio button)

    if user select item1 ,the report should sore by that.

    how to do that

  • you will need to build an expression in the ordering of the tablix based on the parameter values

    something like

    =IIF(Param!Item1.Value=True, Item1, IIF(Param!Item2.Value = True, Item2..............) untill all possible combinations of the sorting are done,

    so can you only ever sort by one column at once, so you can sort ONLY by Item1 or Item2 or Item3, then you need 3 IIF statements, or can you sort by Item1 and Item2, or Item1 and Item3, or Item2 and Item3, if so thats where it starts to get complex

  • Using SWITCH would be easier than using multiple nested IIF. A switch is a series of boolean tests and return values that will return the first value where the boolean test returns a true.

    SWITCH(Param!Item1.Value=True, Item1,Param!Item2.Value=True, Item2,Param!Item3.Value=True, Item3,Param!Item4.Value=True, Item4) and so on. If more than one condition evaluates to True then the value for the first condition that evaluates to true will be returned.

    The only thing you have to know is that SWITCH does not really have a functional ELSE. However there is an easy work around. If you need an ELSE for a default sort then your last boolean and return value would be like this: 1=1,DefaultSortValue

  • but i have only 1 multivalued param,

    which has following values

    label1 value1

    label2 value2

    what expression should i put in sorting expression,

  • i done this way

    =iif(Parameters!sortby.Value= "item1",Fields!item.Value,iif(Parameters!sortby.Value = "mv",Fields!MV.Value))

    i did this in by right click->tablix properties-?expression

    i have multivalued param like this

    label value

    item item1

    market mv

    this expression gives me error

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply