A paginated report can often meet requirements using report expressions and dataset queries. Custom code is an advanced option for reusable calculations or formatting that the standard expression language does not conveniently express.
Choose the simplest layer
Perform filtering and aggregations in the dataset when it makes results more accurate and reusable. Use report expressions for display logic. Resort to custom code only when the extra maintenance is justified.
Illustrative expression
=IIF(Fields!TotalAmount.Value >= 1000, "Large Order", "Standard Order")
Custom code considerations
Report Builder and older SSRS designers support custom Visual Basic code in some report contexts. Check the target report-server version and designer because supported assemblies and security restrictions vary. Do not embed credentials, filesystem assumptions, or untrusted input in report code.
Test the published version
Validate the same report in the designer and on the server. Render to PDF and Excel; check null values, culture-specific formatting, parameters, and export layout.
Version note
As of SQL Server 2025, Microsoft directs new on-premises reporting deployments to Power BI Report Server. Check current documentation for deployment and supported custom-code features.
About this article: This AI-generated educational rewrite was prepared from an existing Open Education article, with new explanations and illustrative examples where helpful. Read the earlier article (post 72827). The new text may be freely copied, edited, and reused with or without attribution to this site. Third-party material, brand names, and linked resources retain their own rights. AI can make mistakes: verify syntax, version support, security practices, and outcomes against official documentation before use, especially in production.
