Very slow load time on page displaying large Template repeater

I convert mine to string and it respects decimal and commas when converting to string.

I was using the following script to convert the float to a string but this didn’t keep the commas in the final value.

#Funtion to return just the sought after value or None if there is bad quality data		
def readFloat(tagPath):
	try:
		qualifiedValue = system.tag.read(tagPath)
		if qualifiedValue.quality.isGood():
			return  '%.1f' % qualifiedValue.value #Format the Float Value
		else:
			return ''
		
	except:
		return 0	

If you have converted over to using datasets and tables, here is what you can do to dynamically replace 0 values with blanks on display. This example is using a 'Power Table'.
Open up the Component Scripting for the Power Table, Enable the 'configureCell' Extension Function, then add in the following, replacing the colName comparisons appropriately.

	if colName == 'Int Column':
		if value == 0:
			textValue = ''
	elif colName == 'Float Column':
		if value == 0.0:
			textValue = ''
	
	return { 'text': textValue }
	

Thanks Bill, this gets tricky because I didn’t want to hide all zeroes, only zeroes where the tag itself was not enabled. I ended up doing this by creating a dataset that had 3 entries per value I wanted to display. Data columns for entry 2 and 3 are always hidden in the table itself.

  • Entry 1: The Value
  • Entry 2: Is Enabled - If this is false i set the text of value to transparent so the table does not show the value
  • Entry 3: Is Bad Quality - I brought this to highlight the cell red if the data was bad quality so the user knows the data should probably not be trusted.

Sorry, I mispoke. When using system.tag.read, It respects the decimal but not the comma. Some of my tag data gets saved in a table as a float, and when I pull from that and then convert to string, it will respect the comma. I keep a separate table for things like previous day volumes on gas meters, oil meters, and water meters where I can query those things out without having to deal with Ignitions Tag History. I can also guarantee that if a device doesnt poll after the contract hour, a new value doesnt get put in for the day.

I havent had anyone complain about not having the comma.

Well, you get the whole dataset given to you as well as the current row in the dataset, you just need to do the data.getValueAt before the check for 0 to retrieve the other qualifiers and react appropriately. I recommend using column names when retrieving from the dataset rather than column numbers. Here is a small sample to give you an idea. I took a Power Table, filled it with sample data (simple checkbox) then applied this, and some rows went red, some went blank...

	background = self.background
	
	if colName == "Int Column":
		boolVal = self.data.getValueAt(rowIndex, 'Boolean Column')
		if value < 50:
			if not boolVal:
				textValue = ''
			else:
				background = system.gui.color(255,0,0)
	
	return { 'background': background, 'text': textValue }
	

The return is a map, so you can include foreground and background colors in addition to the text value. This is a fairly common thing to do.

They give you in the example, the way to color the background for every other line, because for the simple table type that is just a checkbox. Not really sure why they couldn't have done the same thing for the Power Table.

BTW: Just to be clear.. I'm saying that the actual value stored in your dataset should be the actual value, not some kind of string value. The configureCell basically is doing the conversion to a string already as part of displaying the cell. If you really want to dig in deeply, you could also define a renderer for the cell, but for most and I mean MOST cases you don't want to give yourself that kind of pain.

2 Likes