none
Is it possible to change grouping and sorting with a parameter? RRS feed

  • Question

  • I have a aspx page that has a reportviewer control on it, and lets the user select different reports. I also have a dropdown box that has a list of different fields to sort on.

    I have a parameter called 'Sortby' in the report, I changed the groups static sorting from  =Fields!LName.Value to =Parameters!Sortby.value, with the value of Sortby a string of the field I want to sort. ie: Sortby = "Fields!WHatever.value"

    This does not work for me, is this possible? The report does not sort any different when I pass these parameters in when using the Sortby parameter. The report does sort perfect using a static field.


    I can pass parameters into the report, because when I use them for the report header in a label they work perfectly.

    Any help would be appreciated

    Thanks
    Bill
    Monday, June 8, 2009 3:25 PM

Answers

  • This is possible.  But the group and sort expressions need to resolve to field values, not the name of the field.  So you probably want something like this:

    =Fields(Parameters!Sortby.value).value
    • Marked as answer by OrlandoBill Thursday, June 18, 2009 11:53 PM
    Thursday, June 18, 2009 5:27 PM
    Moderator

All replies

  • This is possible.  But the group and sort expressions need to resolve to field values, not the name of the field.  So you probably want something like this:

    =Fields(Parameters!Sortby.value).value
    • Marked as answer by OrlandoBill Thursday, June 18, 2009 11:53 PM
    Thursday, June 18, 2009 5:27 PM
    Moderator
  • Thanks, I had almost given up. In fact I created several reports that the grouping was hard-coded, I just got done deleting all except one report, and I can use a dropdown box to select grouping and sorting. Life is good!

    Again Thanks
    Bill
    Thursday, June 18, 2009 11:52 PM