Color Power Table configuration

I just tested it, and it works for me.

  1. add power table
  2. add data (NOMBRE is string column, Prox. Mant. is string column)
  3. add configureCell Script
now = system.date.now()
exp = system.date.parse(self.data.getValueAt(rowIndex, 'Prox. Mant.'), 'dd/MMM/yyyy')
# if current date is greater than the expiration 
if now >= exp:
	return {'background': 'red'}
	
# if the current date is within 5 months of expiration
elif system.date.monthsBetween(now, exp) <= 5: 
	return {'background': 'yellow'}
	
else:
	return {'background': 'green'}

image

If Prox. Mant. is already a date type column and not a string, then you don’t need system.date.parse just the getValueAt part

now = system.date.now()
exp = self.data.getValueAt(rowIndex, 'Prox. Mant.')
# if current date is greater than the expiration 
if now >= exp:
	return {'background': 'red'}
	
# if the current date is within 5 months of expiration
elif system.date.monthsBetween(now, exp) <= 5: 
	return {'background': 'yellow'}
	
else:
	return {'background': 'green'}

image