Monday 5 May 2014

Serial Number in SSRS Report


Serial Number By Default

This is most common issue that always comes when we generate SSRS tablix reports. All time we need to create Serial Number like 1,2,3.... in vertical column.

SSRS By default provide a inbuilt function which will do a lot for you. 

= RowNumber(Nothing)

We just need to do write the above line of code In the code expression place.

Serial Number On Group

Again as always Microsoft does, You need to replace Nothing with GroupName will call as serial number on group and Also its very similar in condition all type of regions.

= RowNumber(FiledGroup)
= RowNumber(FiledGroupRegion)
= RowNumber(FiledGroupRegion)

 Number Generation By code

if above method doesn't full fill your criteria the Plaese do some change in Code.

1- Open report properties> Click On Code > Write this Line of code.

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

Go to the properties of the group (based on which group you need the group serial number).
 
 Click the variables tab on the left.
 Click on Add and set Name as GroupCountValue and set the expression (in the expression window) as
=Code.getCounter, click ok and close the window.
 Now in the textbox where you want to display the Serial number, set the expression as
=Variables!GroupCountValue.Value
 Run the report and observe the result.
I hope this will help.

Regards,
Sathish
http://sathish-nav.blogspot.com





No comments:

Post a Comment