# Table Conditional Formating

**URL:** <https://forum.inductiveautomation.com/t/table-conditional-formating/110937>\
**Category:** Ignition\
**Tags:** reporting\
**Created:** [September 24, 2025, 6:40pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937 "2025-09-24T18:40:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Frei](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@Matthew\_Frei](https://forum.inductiveautomation.com/u/Matthew_Frei)\
**Post date:** [September 24, 2025, 6:40pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/1 "2025-09-24T18:40:44Z")

</div>

Hello,

Hoping this will be a quick answer. But, I’m building a report and want to highlight certain rows based on the Time/Date. But, I still need to see All of the data. Think of it like highlighting Values in a peak period. The formatting is based 1. on the day of the week and 2. on the time of day.

For example: If I wanted to highlight rows on “Wednesday” after 10, but the table looks like the following.

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

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/d/9d6b626be69f311dd62894682b2b78f15a2e5f9f.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/b/6bebb21426cd5081b128a85920d9f0f3ee595af2.png)

I’m sure I’m referencing my time of day value wrong, but I’m also unsure if my nested condition is correct either. It must be evaluating as “True” because all of the cells are highlighted.

Thank you in advance!!

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [September 24, 2025, 7:08pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/2 "2025-09-24T19:08:58Z")

</div>

You can't compare a date against a string and an integer. You'll need to create separate parameters that store the day of the week string and hour integer for comparison.

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/1/61a5aaecb8bd463aad0d7392d463da9a1ec8600f.png)

---

<div class="post-metadata">

**Author:** ![Matthew\_Frei](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@Matthew\_Frei](https://forum.inductiveautomation.com/u/Matthew_Frei)\
**Post date:** [September 24, 2025, 7:22pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/3 "2025-09-24T19:22:06Z")

</div>

my “t\_stamp” value is coming from my Historical Tag Query, so it’s not a report parameter. Does that change things?

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [September 24, 2025, 7:25pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/4 "2025-09-24T19:25:55Z")

</div>

Yes, you can add a script Data Source:

```python
def updateData(data, sample):
	data['dayOfWeek'] = system.date.format(data['t_stamp'], 'EEEEE')
	data['hour'] = system.date.format(data['t_stamp'], 'HH')

```

If it's nested under a query data object, it might be something like:  
`data['queryData']['t_stamp']`.

---

<div class="post-metadata">

**Author:** ![Matthew\_Frei](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@Matthew\_Frei](https://forum.inductiveautomation.com/u/Matthew_Frei)\
**Post date:** [September 24, 2025, 8:12pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/5 "2025-09-24T20:12:15Z")

</div>

I think I’m missing something….

My Tag Historian Query

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

I’m assuming I need to replace the “data” in the system.date.format() to my Historian data source? So it would look like data['dayOfWeek'] = system.date.format(Total\_demand\_kW['t\_stamp'], "EEEEE").

But it doesn’t recognize Total\_demand\_kW that as a global name

Leaving it as “data” gives me an updateDataKeyError for the t\_stamp

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [September 24, 2025, 8:25pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/6 "2025-09-24T20:25:04Z")

</div>

Try:  
`system.date.format(data['Total_Demand_kW']['t_stamp'], 'EEEE')`

Whatever you see under "Data Sources" in the Key Browser should be available as a value within the `data` dict.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/3/b3bfa07509354000417a2b615e9aa99bddd123fa.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:** [September 24, 2025, 8:36pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/7 "2025-09-24T20:36:27Z")

</div>

Uhm, you have to iterate through your query result and construct a new one.....

`data['Total_Demand_kW']` will be a `QueryResult` object, which contains a dataset.

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [September 24, 2025, 8:43pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/8 "2025-09-24T20:43:08Z")

</div>

Oh, right. Have to add the hour and day of week as new columns to that dataset...

---

<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:** [September 24, 2025, 9:40pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/9 "2025-09-24T21:40:58Z")

</div>

Lots of discussions with [QueryResults](https://forum.inductiveautomation.com/search?q=QueryResults%20order%253Alatest). Look for the ones with `system.dataset.toDataSet()` and/or `DatasetBuilder()`.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 24, 2025, 9:50pm UTC](https://forum.inductiveautomation.com/t/table-conditional-formating/110937/10 "2025-09-24T21:50:19Z")

</div>

As a tangent, I'd probably add a row to the dataset that defined whatever condition(s) you want to express as formatting.

That is - add a column that contains either `null` or `"OutOfRange"` or whatever, based on your full business logic (expressed in Python code within your script datasource). Then give the report row 'alternate' versions based on that column, and only deal with the _presentation_ within those alternate rows.

You'll save yourself a lot of grief down the road if the business logic ever has to change and you don't have to click between a hundred table rows and cells trying to find all the key expressions you set up.
