SSRS (SQL Server Reporting Services) – Manages custom codes in SSRS
Managing Custom/Embed Codes in SSRS (SQL Server Reporting Services)
Even though, SSRS having lot of built-in functions as we discusses above, we write our custom codes here. These code should be written in Visual Basic only. And also, we can use display constant value. You must write the code inside a public, shared function. Then only, you can catch out these results in your reports. You need to pass values from the report into your function to perform calculations.
Creating our own custom Codes
Right click on empty page of your report and select properties from that showing menu and it show Report Properties Dialog Box.
Click Code tab and write your all your variables and functions.
Public Const MyNote = "Authored by Prabu Thangavelu"
public shared function setColor(byval value as integer) as string
if value < 10 then
else if value > 10 and value < 220 then
Call our custom Codes in report
Place a textbox in report and right click on that textbox and select expression and it shows Edit Expression Dialog Box. Write following code in that Dialog Box.
Click Preview and you can see how it shows results.
Here, you should be careful in one thing, that is, the report should be designed and connected with databases. Then only you can pass integer values for that function.
Click Preview and enjoy your results.
thanks a lot.. saved lot of time ..