Alarms set bit state,how to set Event Value equal to bit value?

Tag Alarms set Bit State.

How to set Event Value equal to Bit value ,not to Value?

Can you display the bitPosition in the alarm table? Otherwise, you might need to create an associated data with the bit number in it and display that :confused:

Yeah! I add an associated data in it.
I can see the associated data in alarm info.
But this new associated data can't show in Alarm Status Table Columns.

One approach that would work would be to move your associated data expression to the label property:
image

Then, you could use the method I developed for renaming alarm status table columns to change the column headers in the table:

if event.propertyName == 'componentRunning':
	def getTable(statusTable):
		for component in statusTable.getComponents():
			if component.__class__.__name__ == 'AlarmStatusTable$1':
				return component
			else:
				table = getTable(component)
				if table:
					return table
	
	table = getTable(event.source)
	tableHeader= table.tableHeader
	columnModel = table.columnModel
	for column in range(table.columnCount):
		tableColumn = columnModel.getColumn(column)
		if tableColumn.headerValue == 'Label':
			tableColumn.setHeaderValue("Real Alarm Value")
		elif tableColumn.headerValue == 'Event Value':
			tableColumn.setHeaderValue("Tag Value")
	tableHeader.repaint()

Result:
image

2 Likes

This is a good solution. :clap: :clap:
Thank you very much!

1 Like