Sorting reports rdlc with parameter RRS feed

  • Question

  • Hi.

    How can I know when a Field is of type String?

    Im sorting some reports base on a parameter like this:


    The problem is when the user selects a field (to sort) that isnt numeric (product name for example), throws an error because cant Sum(text)...

    I have try comparing types =IIF(Field(Parameters!OrderBy.Value).GetType().Name = System.Type.GetType("System.String").Name ....
    but no luck...

    Can any one help me?

    Friday, September 18, 2009 12:40 AM


  • Hi G,


    It sounds like you want to sort the column only the column is Numeric type. If I have misunderstood, please do not hesitate to let me know.


    In SQL Server Reporting Services, we can use the function “IsNumeric” to check if a field is Numeric type.


    So, to solve the issue, we can use the following expression:

    =IIF(Parameters!AscDesc.Value="ASC",IIF(IsNumeric(Fields(Parameters!OrderBy.Value).Value),  Sum(Fields(Parameters!OrderBy.Value).Value, 0),0)


    Please feel free to ask, if you have any more questions.



    Jin Chen

    Jin Chen - MSFT
    Wednesday, September 23, 2009 9:36 AM