Progress® Telerik® Reporting R3 2017

Conditional Formatting

You can design a report so that different styles are applied to items based on the data in the report. For example, you can display negative numbers in red or change the background colors on a table cell.

To make styles conditional, use an expression instead of a static value for the style properties of the report item. For example, to make a text box render negative values in red for a field called Profit:

Using Conditional Formatting Editor

  1. Open the Edit Formatting Rule dialog.
  2. Enter the conditional expression:
    =Fields.Profit
  3. Enter the operator:
  4. Enter the value expression:
  5. In the Edit Style dialog select Red color for the Background.

Using Bindings

  1. To use Bindings we need to implement a helper User Function:

    public static Color ColorFromName(string colorName)
    {
        if (!string.IsNullOrEmpty(colorName))
        {
            return Color.FromName(colorName);
        }
        return Color.Transparent;
    }
  2. In the Bindings Editor select the Style.BackGroundColor property.

  3. Enter the next expression:
    =Iif(Fields.Profit < 0, ColorFromName("Red"), ColorFromName("White"))

See Also

Other Resources