none
How do I Interpret a String Value as an Expression and not a String?

    Question

  • We use a lot of parameter driven dynmic grouping within our SSRS 2008 R2 reports which means a fair number of rather unsightly nested IIF statements in the "Value" expression for the grouped row.  As an experiment, I created a table of grouping values for the report and then wrote a stored procedure to dynamically build the IIF statement.  The problem I'm having, however, is that I can't seem to get the returned string to be recognized as code and not a literal string.  In other words, the text box displays the actual IIF statement and not the appropriate field value resulting from the evaluated IIF.

    Any suggestions on how I can get the above to be evaluated as an expression and not a string?

    Thanks

    Ken

    Friday, March 02, 2012 4:17 PM

Answers

All replies

  • Not a direct answer to your question, but if you can do something like this instead, I think everything might be a bit simpler:

    http://blogs.msdn.com/b/chrishays/archive/2004/07/15/dynamicgrouping.aspx

    • Marked as answer by KSchram Monday, March 05, 2012 3:24 PM
    Saturday, March 03, 2012 2:34 PM
  • 'Expression' is a method to handle your dataset values, if you generate it in your SP, it will become a value.

    So, you need to handle your scenario by passing parameters to SP or handling your dataset values by Expression.


    Regards, Nighting Liu

    • Marked as answer by KSchram Saturday, March 03, 2012 6:58 PM
    Saturday, March 03, 2012 4:02 PM
  • Thank you for the replies, gentlemen. After spending some more time with Google I figured I was out of luck. While the primary driver was to be able to manage the grouping using the database without having to modify the RDL, making the code more readable was a close second. During my research I discovered the SWITCH() function which certainly cleans things up and I'm also anxious to give the "=Fields(Parameters!OuterGroupBy.Value).Value" logic a try as it appears to be an even cleaner, more concise option. Thanks again for the suggestions.
    Saturday, March 03, 2012 7:03 PM