nerdexam
Microsoft

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.

Build reports

Question

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 unit has a unique color scheme combination of foreground and background colors. You need to ensure that all of the text boxes in the table headers use the correct business unit colors. What should you do? (More than one answer choice may achieve the goal. Select the BEST answer.)

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)
  • A
    3% (1)
  • B
    5% (2)
  • C
    8% (3)
  • D
    84% (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.

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.

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.

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.

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.

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.

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.

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.Correct

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

#report variables#dynamic color formatting#BackgroundColor property#code functions

Community Discussion

No community discussion yet for this question.

Full 70-466 Practice