none
reset Serial Number when group change in SSRS Report

    Question

  • how to reset record number when a group changes in ssrs

    i have a code to generate a SrNo.

    dim Counter as integer=0 
    public function getGroupCounter() as Integer 
    Counter=Counter+1
     return Counter 
    end function

    Saturday, August 17, 2013 8:48 AM

Answers

  • Hi Dilip,

    We can pass group name to the custom code, if the group name not changed, then Counter=Counter+1, otherwise, reset counter to 1. The custom code would like below.

    dim shared Counter as integer=0 
    dim shared Group as String
    public function getGroupCounter(GroupName as String) as Integer 
    If Group=GroupName Then
       Counter=Counter+1
    Else
       Counter=1
    End If
    Group=GroupName 
    return Counter 
    end function

    Then use the expression below to get the counter
    =Code.getGroupCounter(Field!Group.Value)

    If you have any questions, please feel free to ask.

    Regards,


    Charlie Liao
    TechNet Community Support

    Tuesday, August 20, 2013 9:44 AM
    Moderator