Row Number

  • I want to add a row number at the bottom of my table on SSRS

    what is the code for it?

  • Are you trying to add a field to your table which will indicate the "row number" of the row? In that case, what you want to do is add an identity field to the table, like this:

    ALTER TABLE [TableName] ADD [FieldName] INT IDENTITY (1,1)

    If you're trying to add a row number to your query result set, then what you want is this:

    SELECT

    [Criteria],

    ROW_NUMBER() OVER (ORDER BY [ColumnName])

    FROM

    [Table]

    WHERE

    [WhereClauses]

  • Not clear buddy you want to add a row number or a page number??

  • i want to add a row number to the bottom of the table in SSRS.... so it count how many rows i have

  • Well, this isn't really the right forum for SSRS questions, but you've got several ways you could accomplish this. One of them is to use the ROW_NUMBER function that I mentioned above as part of your query, and then do a MAX() call against the ROW_NUMBER field to get the number of rows.

  • Use this SSRS function:

    RowNumber(scope)

    Parameters

    scope

    (String) The name of a dataset, data region, or group, or null (Nothing in Visual Basic), that specifies the outermost context, usually the report dataset.

  • how do i set the scope to 'String'?

  • joseph_smithy (7/17/2009)


    how do i set the scope to 'String'?

    The scope isn't String, the scope's type is String. The value is the data set in your case.

  • Got it now...

    The name of my dataset it 'DrillThru'

    So if i enter the following on the bottom row of my table.

    =RowNumber(DrillThru)

    I get the following error -

    Error1[rsInvalidAggregateScope] The Value expression for the textbox ‘textbox8’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a data set.00

  • Did you try =RowNumber(Nothing)

  • Try this =RowNumber("DrillThru")

  • Try this

    =RowNumber("DrillThru")

  • joseph_smithy-1130150 (7/17/2009)


    i want to add a row number to the bottom of the table in SSRS.... so it count how many rows i have

    You could also use "=count(Fields!?????????.Value)" as the expression if the rownumber(nothing) doesn't work for you.

  • Thanks! "Nothing" fixed it.

  • you can use dataset name with ", see below example

    =RowNumber("DrillThru")

    you can also use nothing, if you want sequence number and not reset on specific field.

Viewing 15 posts - 1 through 14 (of 14 total)

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