set_conditional_row_color
Color tablix detail rows based on field values using a Switch expression, mapping values to colors with a customizable fallback.
Instructions
Color every cell of a tablix's detail row based on the value of one of its fields. Builds a Switch(...) expression mapping field values to colors and writes it as BackgroundColor on every detail cell. value_expression is the field reference (e.g. 'Fields!Status.Value' — a leading '=' is accepted). color_map is an ordered dict of value->color (e.g. {"Red":"#FF0000","Yellow":"#FFFF00"}); first match wins. Unmatched values fall back to default_color (default 'Transparent'). When case_sensitive is False (default), wraps the field reference in UCase() and uppercases the keys for case-insensitive matching. Walks the row hierarchy to find the Details leaf — works after add_row_group nests the structure. Replaces any existing BackgroundColor.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| color_map | Yes | Ordered map of expected values to color strings. First match in declaration order wins. | |
| tablix_name | Yes | ||
| default_color | No | Transparent | |
| case_sensitive | No | ||
| value_expression | Yes | Field reference to switch on, e.g. 'Fields!Status.Value'. Leading '=' optional. |