Alarm Table filterAlarm Help

I have made a custom property searchString on my alarm table and it is bound to a textbox’s text value. I have the following code:

def filterAlarm(self, alarmEvent):
	#valid search string given
	if self.searchString:
		#lower everything
		search = searchString.lower()
		label = alarmEvent.get("Label").lower()
		
		#look for searchString in label
		if search in label:
			#show if found
			return True
		else:
			#hide if not found
			return False
	#show all if no search string given
	else:
		return True

Entering a value in the textbox does not change the events in the table. All alarm events are still shown. Am I missing something?

Do I need to use a propertyChange event to fire the extension function? If so, how do I call it?

The filterAlarm extension function should be getting invoked once per alarm every 2.5 refresh-rate-property milliseconds when the alarm status table automatically polls in the background. If you throw a debug print or similar (above any of your own code) is that happening?

In the console I’m getting a “self.searchString” not defined error. I used the property picker to get the property path.

Heh. Sounds like a missing PyComponentWrapper.

If so, the simplest solution is to install my Integration Toolkit. (That's it.)

There are more complex alternatives if you cannot do that.

Simple workaround that worked.

def filterAlarm(self, alarmEvent):
	#valid search string given
	searchString = self.parent.parent.getComponent('Text Field').text
	if searchString:
		#lower everything
		search = searchString.lower()
		label = alarmEvent.get("Label").lower()
		
		#look for searchString in label
		if search in label:
			#show if found
			return True
		else:
			#hide if not found
			return False
	#show all if no search string given
	else:
		return True

I guess the alarm table doesn’t like custom properties

Trying to do the same thing with an alarm journal but there’s no poll rate. How do I force the table to update when the string changes?

Try setting one of the internal properties that changes what values are display (min priority, search filter, etc) to itself?

Cannot bind a property to itself. Also, there are other bindings that already exist on the alarm journal

That's what I was alluding to. My Integration Toolkit fixes that anywhere it happens.

Any ideas on how to filter the label for an Alarm Journal?

I tried calling it from the text box propertyChange script but the object retrieved is not a Vision.Components.AlarmJournalTable it’s a com.inductiveautomation.factorypmi.application.com object

if event.propertyName == 'text':
	table = event.source.parent.getComponent('Container').getComponent('Alarm Journal')
	table.filterAlarm()
  1. Install my Integration Toolkit.

  2. Try your code in your OP.

Stole this idea and put an invisible “refresh” button next to the text box. Works nicely.

if event.propertyName == 'text':
	button = event.source.parent.getComponent('Button 1')
	button.doClick()
#current startDate
startDate = event.source.parent.parent.startDate

#add one minute and set the date to "refresh"
startDate = system.date.addMinutes(startDate, -1)
event.source.parent.getComponent('Container').getComponent('Popup Calendar').date = startDate

#subtract one minute and set the date to "refresh"
startDate = system.date.addMinutes(startDate, 1)
event.source.parent.getComponent('Container').getComponent('Popup Calendar').date = startDate

Not a binding, a script.
As in something like alarmStatusTable.setMinPriority(alarmStatusTable.getMinPriority).