Preserve or reimplement column settings in a table data script transform?

I have a perspective table that is populated with a named query. One column that comes through as an int had the column made to turn it into a progress bar like so
image

which resulted in

image

I wanted to color the background with a transform script so I did that with the following

	import system.date
	pydset = system.dataset.toPyDataSet(value)
	returned_rows = []
	for row in pydset:
		row_dict = {}
		unStyledColumns = ["plantNumber","plantName","LocalDataTableName","LastUpdated","LastRecordDateTime","recordsPerHourAvg","LastAttemp_Status","LastUpdated_Status","LastRecordDateTime_Status"]
			
		if row['LastAttempt'] is None:
			row_dict['LastAttempt'] = {'value': row['LastAttempt'], 'style':{'classes':'TableStyles/WarningRecordCount'}}
		elif system.date.hoursBetween(row['LastAttempt'],timestamp) > 1:
			row_dict['LastAttempt'] = {'value': row['LastAttempt'], 'style':{'classes':'TableStyles/BadRecordCount'}}
		else:
			row_dict['LastAttempt'] = {'value': row['LastAttempt']}
			
		# Style Record Columns 
		recordsTotal = int(row['recordsTotal'])
		recordTotalDefault = {'value': recordsTotal}
		recordsTotalClass = None
		if recordsTotal < 5:
			recordsTotalClass =  {'classes':'TableStyles/BadRecordCount'}
		elif recordsTotal < 10:
			recordsTotalClass = {'classes':'TableStyles/WarningRecordCount'}
		else:
			recordsTotalClass = {'classes':'TableStyles/GoodRecordCount'}
		recordTotalDefault['style'] = recordsTotalClass
		row_dict['recordsTotal'] = recordTotalDefault
		
		# Unstyled columns
		for column in unStyledColumns:
			row_dict[column] = {'value':row[column]}

		returned_rows.append(row_dict)
	return returned_rows

Although my recordsTotal column is now red, the progressBar is gone and I can’t seem to get it back. Is there a way to either have the column setting override any defaults of the script transform or is the way to inform the column its a progress bar via script transform and if so how?

If there’s a link to documentation regarding how to use script transform to set other properties like this I wouldn’t mind reading through it but I can’t find anything like that from my searches.

Try changing the column’s ‘render’ property to ‘number’ instead of ‘auto’. That resolves the issue in my case.

1 Like

Thank you that did it.