70-466 · Question #15
You are developing a new SQL Server Reporting Services (SSRS) report in SQL Server Data Tools (SSDT). The report must define a report parameter to prompt the user for the business unit. Each business
The correct answer is D. Add two Microsoft Visual C# functions to the code block of the report to implement Color and BackgroundColor functions. For each header text box, use expressions to set the Color and BackgroundColor properties by using the functions.. SSRS custom code functions provide centralized, reusable logic for dynamic color theming driven by a report parameter, and are the preferred approach over report variables.
Question
Options
- AAdd one report variable for Color. Assign it with an expression to return the appropriate colors. For each header text box, set the Color and BackgroundColor properties by using the variable.
- BAdd two report variables named Color and BackgroundColor. Assign them with expressions to return the appropriate colors. For each header text box, use expressions to set the Color and BackgroundColor properties by using the variables.
- CFor each header text box, assign expressions to the Color and BackgroundColor properties. Add two Microsoft Visual C# functions to the code block of the report to implement Color and BackgroundColor functions.
- DAdd two Microsoft Visual C# functions to the code block of the report to implement Color and BackgroundColor functions. For each header text box, use expressions to set the Color and BackgroundColor properties by using the functions.
How the community answered
(37 responses)- A3% (1)
- B5% (2)
- C8% (3)
- D84% (31)
Why each option
SSRS custom code functions provide centralized, reusable logic for dynamic color theming driven by a report parameter, and are the preferred approach over report variables.
A single report variable cannot store both a foreground and a background color value simultaneously, so one variable is insufficient to satisfy both color requirements.
Report variables are evaluated once and cached for the report lifetime, and while they can use parameter-based expressions, they lack the parameterization and reusability of custom code functions, making functions the cleaner and more maintainable solution.
This option does not explicitly state that the text box expressions call the C# functions, making the relationship between the functions and the property expressions ambiguous and the approach less clearly maintainable than option D.
Adding C# functions to the report code block creates a single, centralized location where color logic based on the business unit parameter is defined. Expressions on each header text box's Color and BackgroundColor properties call these functions, ensuring consistent and maintainable color assignment across all headers without duplicating logic in every individual expression.
Concept tested: SSRS custom code functions for dynamic property expressions
Source: https://learn.microsoft.com/en-us/sql/reporting-services/report-design/custom-code-and-assembly-references-in-expressions-in-report-designer-ssrs
Topics
Community Discussion
No community discussion yet for this question.