# Power Table Component Scripting, configureCell - isAfter Question(s)

**URL:** <https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [January 22, 2020, 1:34am UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500 "2020-01-22T01:34:13Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulm1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paulm1/32/5900_2.png) [@paulm1](https://forum.inductiveautomation.com/u/paulm1)\
**Post date:** [January 22, 2020, 1:34am UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/1 "2020-01-22T01:34:13Z")

</div>

We would like to change the background color of individual Rows within a Power Table based on some system.date calculations.

Take a look below at where we are currently at. no error msg but the row doesn’t turn red.

 ![system_date_isAfter](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/d78eea964f4734a61e3b8b8be1c71515c8eff485.png)

I was thinking of adding the timeFrame(int) to the PMdate and comparing it today’s date(using isAfter) to determine if this task is overdue or not. When Today’s date is after redDate then change backround of that row to Red color.

pmTimeFrame = 30(INT)  
PMdate = 2019-01-23  
Today = 2020-01-21  
redDate = 2019-01-23 + 30

---

<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:** [January 22, 2020, 4:48pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/2 "2020-01-22T16:48:52Z")

</div>

Do you have the arguments to [`system.date.isAfter`](https://docs.inductiveautomation.com/display/DOC80/system.date.isAfter) backwards? Per the manual:

> Compares to dates to see if date\_1 is after date\_2.

---

<div class="post-metadata">

**Author:** ![paulm1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paulm1/32/5900_2.png) [@paulm1](https://forum.inductiveautomation.com/u/paulm1)\
**Post date:** [January 22, 2020, 4:50pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/3 "2020-01-22T16:50:23Z")

</div>

Tried both ways with the same result.

---

<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:** [January 22, 2020, 4:51pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/4 "2020-01-22T16:51:59Z")

</div>

It’ll be noisy, but you can try dumping some print statements in (maybe limit your dataset to only a few rows) - print the final `cellConfigurations` before it’s returned, print the `redDate` and `PMdate` values, maybe add a print inside the `elif` to see if it’s getting hit.

---

<div class="post-metadata">

**Author:** ![paulm1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paulm1/32/5900_2.png) [@paulm1](https://forum.inductiveautomation.com/u/paulm1)\
**Post date:** [January 22, 2020, 4:54pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/5 "2020-01-22T16:54:40Z")

</div>

I’m so green, I just tried to install the print statements.  
would you mind showing me a print example using my original script.

---

<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:** [January 22, 2020, 4:56pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/6 "2020-01-22T16:56:51Z")

</div>

After the `redDate =` line, just add:

```auto
print redDate
print PMdate

```

And then right before `return CellConfigurations`, add `print cellConfigurations` on a new line.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [January 22, 2020, 5:11pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/7 "2020-01-22T17:11:24Z")

</div>

Can you check the console? When there are errors in the configureCell, it will print out a bunch of stuff in the console.

---

<div class="post-metadata">

**Author:** ![paulm1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paulm1/32/5900_2.png) [@paulm1](https://forum.inductiveautomation.com/u/paulm1)\
**Post date:** [January 22, 2020, 5:12pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/8 "2020-01-22T17:12:50Z")

</div>

No luck.  
Does this make sense? I tried a simple script using the Script Console tool.

```auto
 Today = system.date.now(0)
 print Today

```

This script generated this msg -  
Mismatched Input ’ ’ expecting EOF

\*\*\*\*\* Appears my indentations were off. I’m currently testing with the system.date functions.  
\*\*\*\*\* I will post back with any good or bad results.

---

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [January 22, 2020, 5:48pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/9 "2020-01-22T17:48:15Z")

</div>

Another error you might get, system.date.now() doesn’t take any parameters.

[https://docs.inductiveautomation.com/display/DOC80/system.date.now](https://docs.inductiveautomation.com/display/DOC80/system.date.now)

---

<div class="post-metadata">

**Author:** ![paulm1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paulm1/32/5900_2.png) [@paulm1](https://forum.inductiveautomation.com/u/paulm1)\
**Post date:** [January 22, 2020, 5:59pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/10 "2020-01-22T17:59:55Z")

</div>

Thank you. you are right. That was another one of my mistakes that needed fixing.  
Right now this appears to be what will work. This is still testing in the Script Console Tool.

> ```
> pmTimeFrame = int(30)
> pmTimeFrame7 = pmTimeFrame - int(7)
> Today = system.date.now()
> PMdate = system.date.addDays(Today, -17)
> orangeDate = system.date.addDays(PMdate, pmTimeFrame7)
> redDate = system.date.addDays(PMdate, pmTimeFrame)
> 
> if system.date.isAfter(Today, redDate):
> 
> ```
> 
> print "RED"  
> elif system.date.isAfter(Today, orangeDate):  
> print "Orange"  
> else:  
> print "Good"

---

<div class="post-metadata">

**Author:** ![paulm1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paulm1/32/5900_2.png) [@paulm1](https://forum.inductiveautomation.com/u/paulm1)\
**Post date:** [January 22, 2020, 8:24pm UTC](https://forum.inductiveautomation.com/t/power-table-component-scripting-configurecell-isafter-question-s/31500/11 "2020-01-22T20:24:43Z")

</div>

OK I finally have what we were looking for.  
See the pic below for configureCell scripting and also a example of how the table looks.  
Thank you PGriffith, jpark and grietveld for your help.

 ![system_date_isAfter2](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7f389404984fb65121f8d19d3ffa2222e75ac897.png)
