Changing the foreground of a powertable row based on the result of an expression using datetime

I have a power table where I’d like to customize the foreground text color depending on the results of certain columns for that row, e.g. If Datetime Column A and Datetime Column B have a difference of more than 2 days, than the text will be red, otherwise it will be black. I am currently writing the script in the configureCell section of Component Scripting for the power table

I am not sure how exactly to go about grabbing these variables for all rows, and I’m not sure if I will be able to import the datetime library, since it seems I’m only able to edit the configureCell function, and as far as I know libraries should be imported at the very top of the script. Any help would be appreciated. Thank you

I think you should be able to use system.date.daysBetween().

EDIT: More likey, use hours or minutes between, as the result is an integer. :wink:

1 Like

Thanks, I didn’t know about that! To access the columns for each row, what would that look like? I’m not exactly sure how to access the colIndex values per row.
Will I need a for loop from range(0,Count) of the table, or is there an easier way to apply it to all rows?