Highlight worksheet rows to bring attention to important data in your worksheets, or to values that need review.
You can configure a worksheet row to be highlighted automatically with a color if a field's value in that raw matches predefined criteria. For example, you might want to highlight a row when a specific field's value exceeds or falls below a certain number.
Before you begin
This feature is designed for use only by configuration teams. You can configure this feature only through an API request.
Variables definition
In this topic, we use variables instead of real values to define information such as an authorization token or API host. To run a request, replace the following variables with real values:
{{ApiHost}}—API host for your environment. For details, read Defining the {{ApiHost}} variable.
{{OAuth2Host}}—OAuth host for your environment. Use this value in theX-Forwarded-Hostheader when sending a request. For details, read Defining the {{OAuth2Host}} variable.
{{OAuthToken}}—Keyword and token required for OAuth 2.0 authentication for your environment. Use this value in theAuthorizationheader when sending a request. For details, read Defining the {{OAuthToken}} variable.
Procedure
To conditionally highlight worksheet rows, use a style object when creating or updating a worksheet through an API request.
Request syntax
-
To create a worksheet, send a request using one of the following syntax:
POST {{ApiHost}}/api/v3/workbook/[workbookID]/worksheetPOST {{ApiHost}}/api/v4/workbook/[workbookID]/worksheet
-
To update a worksheet, send a request using one of the following syntax:
PATCH {{ApiHost}}/api/v3/workbook/[workbookID]/worksheet/[worksheetID]PATCH {{ApiHost}}/api/v4/workbook/[workbookID]/worksheet/[worksheetID]
URI request parameters
A request to create or update a worksheet uses one or both of the following URI parameters.
- [workbookID]—Unique ID of the workbook that contains your worksheet.
- [worksheetID]—Unique ID of your worksheet.
Request headers
A request to create or update a worksheet must include the following headers:
Authorization: {{OAuthToken}}
X-Forwarded-Host: {{OAuth2Host}}
Content-Type: application/json
Request body
A request to create or update a worksheet must include a row JSON document body with a style object. The style object defines the criteria to highlight worksheet rows.
For details about the style object syntax, read the following section.
style object
Use the following syntax for the style object:
{
"style": {
"row": {
"background": [
{
"color": "string",
"conditions": [
{
"field": "string",
"operator": "string",
"value": "string"
}
]
}
]
}
}
}
In the style object, define the following data in the JSON format:
-
row—Object. Can be empty. Contains thebackgroundparameter. -
background—Array of one or multiple objects. Can be empty. Each object defines a highlighting rule. An object that is higher in the script takes priority over objects below. This means that IQ Interface applies the first matching rule to a row and doesn't check any other rules against it.
Each object in thebackgroundarray consists of the following key-value pairs:-
color—String. Defines the HTML color code to use for highlighting a row. Supported colors are defined in the Supported colors section. -
conditions—Array of one or multiple objects. Each object defines a condition to highlight a row and consists of the following key-value pairs:field—String. System name of the worksheet column.operator—String. Defines the validation type for the column value. Supported operators are defined in the Supported operators section.value—String. Column value.min—Integer. Minimal column value. Use this parameter only if you use thebeornboperator. If you use this parameter, you must also use themaxparameter and skip thevalueparameter.max—Integer. Maximal column value. Use this parameter only if you use thebeornboperator. If you use this parameter, you must also use theminparameter and skip thevalueparameter.
TipObjects in the
conditionsarray are combined using the AND logic. This means that IQ Interface applies a rule to a row only if all conditions specified in that rule are met. If any condition fails, IQ Interface doesn't apply this rule to a row and starts verifying the next rule in thebackgroundarray.
-
Supported colors
The style object accepts the following HTML color codes:
| Color code | Definition |
|---|---|
| #FFEEE9 | Light red |
| #FDEEFF | Light purple |
| #E5F4FF | Light blue |
| #D8FFF8 | Light turquoise |
| #E0FAE8 | Light green |
| #FFF8CE | Light yellow |
| #FFB7A3 | Red |
| #F5ADFF | Purple |
| #AEDAFE | Blue |
| #75F5DD | Turquoise |
| #7AE19C | Green |
| #FFE75C | Yellow |
Supported operators
The style object accepts condition operators listed in the table below.
| Operator | Definition | Supported column types |
|---|---|---|
| eq | Equals | Numeric, date, datetime, string, and boolean |
| ne | Not equals | Numeric, date, datetime, and string |
| co | Contains | String |
| nc | Not contains | String |
| bw | Begins with | String |
| ew | Ends with | String |
| lt | Less | Numeric, date, and datetime |
| le | Less or equals | Numeric, date, and datetime |
| gt | Greater | Numeric, date, and datetime |
| ge | Greater or equals | Numeric, date, and datetime |
| be | Between | Numeric, date, and datetime |
| nb | Not between | Numeric, date, and datetime |
| eq_null | Null | Numeric, date, datetime, and string |
| ne_null | Not null | Numeric, date, datetime, and string |
If you use the be or nb operator, objects in the conditions array must include the min and max parameters instead of the value parameter. For details, read the style object section.
Sample style objects
-
Sample
styleobject with a condition for a string type column:{ "style": { "row": { "background": [ { "color": "#FFB7A3", "conditions": [ { "field": "Region", "operator": "bw", "value": "Col" } ] } ] } } } -
Sample
styleobject with a condition for a datetime type column:{ "style": { "row": { "background": [ { "color": "#FFB7A3", "conditions": [ { "field": "OrderDate", "operator": "be", "min": "1725375411000", "max": "1725461811000" } ] } ] } } }