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

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.

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

Do you have the arguments to system.date.isAfter backwards? Per the manual:

Compares to dates to see if date_1 is after date_2.

Tried both ways with the same result.

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.

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

After the redDate = line, just add:

print redDate
print PMdate

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

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

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

 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.

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

https://docs.inductiveautomation.com/display/DOC80/system.date.now

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”

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.