Numbering rows in report

  • I have a matrix Top 100 report (SQL Server 2008) where I want to add a coluimn with number 1 to 100. The problem is that since the report is filtered I can't use RowNumber, CountRows etc. to add this number (problems with nested aggregated functions)

    In SQL Server 2008 R2 I have solved this bu using the expression "RunningValue(IIf (CountRows() > 0, 1, 0),sum, Nothing )", but this is not possible due to the nested aggregated functions before 2008 R2.

    Someone have another solution to this problem?

  • you have to write Custome code and call it from the Column.

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    Public Shared Dim v_Rownum as Integer = 0

    // Call this function from the Coumn by using Expression

    Public Function GetRowCounter() as Integer

    v_Rownum = v_Rownum +1

    return v_Rownum

    End function

    // To reset Row Counter . Call this function at the Strating of the Report.

    Public Function str_ResetRowCounter() as String

    v_Rownum = 0

    return ""

    End Function

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  • Thanks!

    I will check this. I haven´t used custom code - got any hints of handle thie custome code - where to add calls etc?

  • Hi. There's a good section on working with custom code in this recent article:

    [/url]

  • Hi, and thanx!

    I'm close now. My problem is that when I go to next page tha calculation of rowno adds up, and when I go back to the first page it continues to add up.

    I guess the problem is that I don't know where to add the reset call perhaps?

    / Christofer

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

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