Alert Notification Expressions

I’m planning on going through some Ignition orientation for some of our engineers, but I’ve noticed the documentation is a little light in regards the notification group expressions. From what I remember, we can use Ignitions expression language in this field, but at the same time I’m guessing that some functions aren’t supported (ie runScript()).

Can we get:
[li]- An explainatoin of how the expression field is intended to be used.[/li]
[li]- Which expression language features are legal in the expression field.[/li]
[li]- Some examples of commonly used expressions.[/li][/ul]


You actually should be able to use all of the expression functions, including runScript, if you were so inclined. The default datasource, for functions that have one, will be the connection against which the distribution groups are stored.

You can reference other tags with the standard “{[source]Path}” syntax. Keep in mind, though, that in this scope you don’t have a default tag provider, so you’ll have to full qualify the tag paths.

Additionally, you can reference properties of the alerts that are passing through. The available variables and syntax are the same as that for custom messages. In other words, the variable name in square brackets, inside of curly brackets: “{[SEVERITY]}”.

Fundamentally, distribution groups work like this: For each alert state that is put on the alert bus, the expression is executed. The expression must result in some sort of value that can be interpreted as true or false. If the expression is TRUE, the alert is then sent to any contacts associated with that group. Contacts can be in multiple groups, and a specific alert can evaluate true for any number of groups. Duplicate qualifying contacts will be weeded out.

As for what people do, perhaps the support guys can offer a wider range of examples based on experience, but here are a few things that come to mind:

  1. Time based shifts. Create a group for each shift:
dateExtract(now(),"hour")>8 && dateExtract(now(),"hour")<15

Note: The timeBetween function would seem easier, but there is an outstanding issue with it not working correctly for dates that aren’t fully qualified (that is, only hours), so I didn’t use it for this example.

  1. Reference tags or a db field to enable/disable groups:
toBoolean({[default]Alert Groups/AlertGroup1Enabled})
  1. Filtering alerts based on message parameters. For example, create different groups for different parts of the plant. In the alert settings, put a token in the tag’s alert notes that indicates which group it belongs to, like “#west”, or “#packing”. Then do:

Hope this gives you some ideas. If I missed something, let me know!