Skip to main content
Version: Java (Groovy)

formatRowWhere

The formatRowWhere method applies color formatting to rows of the source table, based on user-specified conditions.

Syntax

table.formatRowWhere(condition, formula)

Parameters

ParameterTypeDescription
conditionString

The condition expression.

formulaString

Formulas to compute formats for columns or rows in the table; e.g., "X = Y > 5 ? RED : NO_FORMATTING". For color formats, the result of each formula must be either a color string (such as a hexadecimal RGB color, e.g. "#040427"), a Color, or a packed long representation of the background and foreground color (as returned by bgfg() or bgfga()).

For decimal formats, the result must be a string, and the formula must be wrapped in the special internal function Decimal(); e.g., "X = Decimal(`$#,##0.00`)".

Returns

A new table applies the specified formatting to the source table.

Examples

In the following example, we use formatRowWhere to paint rows where X is greater than 2 red.

tt = timeTable("PT1S").update("X = ii")

result = tt.formatRowWhere("X > 2", "RED").view()