# Perspective Table Dynamic Row Highlight Based on Dataset Tag Value Match

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [May 17, 2026, 8:15am UTC](https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562 "2026-05-17T08:15:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tejas200010](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tejas200010/32/81552_2.png) [@tejas200010](https://forum.inductiveautomation.com/u/tejas200010)\
**Post date:** [May 17, 2026, 8:15am UTC](https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562/1 "2026-05-17T08:15:08Z")

</div>

Hi All,

I am working on an Ignition Perspective Table component.

My table data is coming from a Dataset Tag:  
[default]IGBT\_ROBOT\_CELL\_PROD/SAP\_RES\_Dataset

The table contains a column:  
"Prod. Order No"

I also have another tag:  
[default]IGBT\_ROBOT\_CELL\_PROD/OrderNumber

Requirement:  
Whenever the value of OrderNumber tag matches any row's "Prod. Order No", I want the entire row to be highlighted dynamically.

I tried:

- Script Transform on props.data

- props.rows.style.classes expression binding

- Row style bindings

But since the table data originates from a Dataset Tag and Perspective internally converts rows into objects containing value/style properties, I am facing issues with row styling and expression syntax.

What is the recommended Perspective approach to dynamically highlight a row based on matching tag value with a dataset column value?

Thanks.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 17, 2026, 1:59pm UTC](https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562/2 "2026-05-17T13:59:22Z")

</div>

The canonical approach would be an expression structure binding on your table's `props.data` referencing the raw dataset and the order number tag. That would have a script transform to generate the row objects, styled or not per the comparison.

I don't like script transforms (mainly for performance), so I would use my Integration Toolkit to perform the above in a single expression binding. Something like this:

```python
transform(
    {[default]IGBT_ROBOT_CELL_PROD/OrderNumber},
    forEach(
        {[default]IGBT_ROBOT_CELL_PROD/SAP_RES_Dataset},
        if(
            it()['Prod. Order No'] = value(),
            asMap(
                forEach(
                    it(), // key/value pairs of the row
                    it()[0], // column key
                    asMap(
                        'value', asMap(it()[1]), // column value nested
                        'style', asMap('backgroundColor', '#ff3333')
                    )
                )
            ),
            asMap(it()) // optimized unstyled conversion of a whole row
        )
    )
)

```

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 18, 2026, 12:37am UTC](https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562/3 "2026-05-18T00:37:27Z")

</div>

One to add to the wiki, @pturmel! (I can do it if you don't have time)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 18, 2026, 1:08am UTC](https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562/4 "2026-05-18T01:08:48Z")

</div>

> [@nminchin](#):
>
> I can do it

Please do.

---

<div class="post-metadata">

**Author:** ![tejas200010](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tejas200010/32/81552_2.png) [@tejas200010](https://forum.inductiveautomation.com/u/tejas200010)\
**Post date:** [May 18, 2026, 7:44am UTC](https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562/5 "2026-05-18T07:44:20Z")

</div>

Hi @pturmel

Thank you for your earlier suggestion on using Expression Structure binding with a Script Transform for dynamic row highlighting.

I implemented it and the row highlighting is working correctly — the matching `Prod. Order No` row gets highlighted as expected.

However, I am seeing an **"Invalid Key"** error inside the table component. I wanted to understand what is this error???

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/0/30fc5b0c7f89e96045ea272d72d9a74984bda691.png)

```python
    # 1. Safely unpack the values from our Expression Structure
    dataset = value.get("myDataset")
    target_order = value.get("currentOrder")
    
    # Return empty if data is missing or bad quality
    if dataset is None or target_order is None:
        return []
        
    # 2. Define the highlight style (you can use background colors or Style Classes)
    # Highlight style for a match:
    highlight_style = {
        "backgroundColor": "#FFFFCC" # Soft yellow highlight
    }
    # Standard style for non-matching rows:
    normal_style = {}

    # 3. Convert the dataset to a PyDataSet so we can iterate through it easily
    py_data = system.dataset.toPyDataSet(dataset)
    
    # Get column names to structure our row objects properly
    headers = dataset.getColumnNames()
    
    # 4. Build the JSON structure Perspective expects
    output_rows = []
    
    for row in py_data:
        # Build the cell data dict for this row
        row_cells = {}
        for header in headers:
            row_cells[header] = row[header]
            
        # Check if this row's order number matches our target tag
        # Replace "Prod. Order No" with the exact spelling of your column header
        if str(row["Prod. Order No"]) == str(target_order):
            row_style = highlight_style
        else:
            row_style = normal_style
            
        # Combine the cells and the dynamic row style into the required Perspective object
        output_rows.append({
            "value": row_cells,
            "style": row_style
        })
        
    return output_rows

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/4280469da0b616b4fe5f8be91752738cf65648ec.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 18, 2026, 11:42am UTC](https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562/6 "2026-05-18T11:42:19Z")

</div>

Yes, Perspective, in the designer, doesn't like keys for mapping objects that have spaces or special characters (basically, keys that are _not_ valid variable names). Not a problem for datasets, but you can't style a dataset.

(This is true whether you generate the problem column names with a transform script, or my expressions, or just by having a query binding return JSON format.)

The simplest solution would be to arrange for the source dataset to have simple column names (this is what I would do).

A more complex solution would be to substitute simple names on the fly in the expression. Would need a custom property to hold the pairs of substitutions.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 18, 2026, 11:48am UTC](https://forum.inductiveautomation.com/t/perspective-table-dynamic-row-highlight-based-on-dataset-tag-value-match/115562/7 "2026-05-18T11:48:00Z")

</div>

> [@pturmel](#):
>
> keys that are valid variable names)

are _not_ valid variable names?
