How can add I rownumbers for each group on a RDLC Report?

前端 未结 2 687
误落风尘
误落风尘 2021-02-10 00:23

How can ı add row numbers like this:

GROUP 1

RowNumber ID Name Age

1            231     test     43
2            32         


        
相关标签:
2条回答
  • 2021-02-10 00:42

    RDLCs have a RowNumber("ScopeName") Function. This will return the row number of the record within the given scope.

    You can see the existing groups for the report below the designer under a "Row Groups" and "Column Groups" headers. Select the column inside the grouping where you want the row number and view the Row Columns, The default names will be:

    [(Group1)
     ≡(Details1)
    

    Set the expression for the Row Number column to be

    =RowNumber("Group1")
    
    0 讨论(0)
  • 2021-02-10 01:02

    Right Click on your Report property then go to code then paste the code below

       Dim private count as integer = 0
       Dim private iniRow as integer = 0
       Dim private iniGrp as Object = ""
       Public function MatrixRow(Byval rowNum as integer,Byval rowGrp as Object) as integer
    
       if iniGrp = "" then
          iniGrp = rowGrp 
       end if
    
      if rowGrp <> iniGrp then
          iniRow = 0 
          count = 0 
          iniGrp = rowGrp 
      end if
    
      if iniRow = 0 then
          iniRow = rowNum
      end if
    
      if rowNum = iniRow then
         count = 0
      end if
    
       count = count + 1
       Return count
      End function
    

    then use this function like

       =Code.MatrixRow(RowNumber(Nothing),(YourgroupfiledNameFromDataest))
    
    0 讨论(0)
提交回复
热议问题