What to know
JMobile Studio, since version 1.90, allow to set up a custom filter into Active Alarms widget to display only specific alarms that match the filter.
This FAQ will explain how to use filter’s expressions by examples.
What to do
Two filters are available into Active Alarm widget:
- First filter “Filter 1” is the default filter.
It’s managed by the Combo box present into the widget, the filter have two options: “Show all alarms” and “Hide Not Triggered” wich, when selected, allows to display only active alarms. - Second filter “Filter 2” is, by default, not configured and available for customization.
Filter’s expressions make use of AWK language, the expressions are applied to the data contained in the selected Filter column of the Alarm widget.
Example 1
In this example the Alarm widget will display all alarms matching Filter1 (“All Alarms” or “Hide Not Triggered” alarms ) with value equal to 10.
Properties settings:
- Filtered column = Value
- Filter expression = 10
Example 2
In this example the goal is to filter the alarms by Severity, showing only the alarm with Severity value from 3 to 6, so alarms with Normal to Critical severity accordingly to the Severity levels that you can see below and that are available as settings into the Alarm Editor.
- 0-not important
- 1-low
- 2-below normal
- 3-normal
- 4-above normal
- 5-high
- 6-critical
Properties settings:
- Filtered column = Severity
- Filter expression = [3-6]
The meaning of the regular expression [3-6] literally is: “the first char of the string have to be a numeric char between 3 and 6”.
Example 3
In this example the goal is to filter the alarms by Value, only the alarms with Value between 11 and 19 will be visualized.
Properties settings:
- Filtered column = Value
- Filter expression = ^(1[1-9]$)
The symbols composing the expression have these meanings:
- ^ = the match must starts from the beginning of the string
- 1[1-9] = the first char must be 1 and the second char must be between 1 and 9
- $ = this is the end of the comparison.
Example 4
In this example the goal is to filter the alarms by Value, in this case the alarm shown will be those wich Value has starting character a number from 2 to 9, followed by any alphanumeric character except line breaks. (2xxx… – 9xxx… where x is any character except for line break)
Properties settings:
- Filtered column = Value
- Filter expression = ^([2-9].*$)
The symbols composing the expression have these meanings:
- ^ = the match must starts from the beginning of the string
- [2-9] = first char must be within 2 and 9
- . = the character matches any character except line break
- * = repeats the previous command for all the next characters of the string
- $ = until the end of the string
Appendix
The “Example project for Filters in alarm widget” can be found here:
Example Projects
More info on AWK language can be found at the link below:
http://www.gnu.org/software/gawk/manual/gawk.html
The following link sends to a site with a regular expression tester with syntax highlighting, contextual help, video tutorial and reference:
http://www.regexr.com/
Applies to
JMobile Studio 1.90 and above
Share this Post: