AlarmBanner.SetFilterForSystem

Use the AlarmBanner.SetFilterForSystem function to set up a custom alarm filter for the Alarm Banner, which users can apply when required. To enable users to select the custom filter, use the AlarmBanner.AddMenuItem function to add a custom menu option to call the required script routine from the Alarm Banner's menu.

You can include multiple SetFilterForSystem routines in your script, to enable users to select the predefined filter that they require from a selection of custom menu options.

Syntax

AlarmBanner.SetFilterForSystem (System, Filter)

Description

Use to provide a custom alarm filter that can be made available for use on the Alarm Banner in ViewX and Virtual ViewX.

Arguments

System {string}

The name of the Geo SCADA Expert system (database) on which alarm filtering is to be applied on the Alarm Banner.

Filter {string}

The alarm filter criteria that are to be applied to the Alarm Banner when the function is triggered. If specifying multiple criteria, use an ampersand (&) to separate the filter entries.

Returns

ParseError {string}

If the specified filter is invalid, returns a string that indicates the parse error.

If a user's User Account has the Can Filter Alarm Banner feature enabled, they will already be able to filter the entries in the Alarm Banner by using the Filter option, accessed from the Alarm Banner's menu. However, the AlarmBanner.SetFilterForSystem function can prove useful in providing access to frequently-used filters without users having to use the Filter window to specify the required filter settings. For example, to provide a custom filter to temporarily restrict the Alarm Banner entries to just alarms that relate to a particular area of plant.

The AlarmBanner.SetFilterForSystem function also enables users whose User Accounts do not have the Can Filter Alarm Banner feature enabled to select predefined custom alarm filters for use on the Alarm Banner.

When a user selects a custom menu option to trigger a SetFilterForSystem routine, the entries in the Alarm Banner are filtered to alarms that fulfill the criteria specified in the script. The entries in the Alarm Banner continue to be restricted to just those alarms to which the logged on user's User Account provides access.

When a filter is applied to the Alarm Banner using the AlarmBanner.SetFilterForSystem function:

When using the AlarmBanner.SetFilterForSystem function to specify custom alarm filters, consider also using the function to provide users with custom menu options to reset the filtering on the Alarm Banner. For example, to remove all filtering, or to revert the filtering back to the logged on user's Default Alarm Filter (if one is set for their User Account). Users will not be able to use the Reset Filter menu option to reset custom filtering that has been set using the AlarmBanner.SetFilterForSystem function.

The custom filtering is removed as soon as the user applies different filtering, selects an option to remove the filtering, or logs off.

 

On a particular Geo SCADA Expert system, custom alarm filters are used to enable users to select one of 4 regions for which they might want the Alarm Banner to display only alarms that have a 'High' or 'Critical' Severity. These filters appear as additional custom menu options when the users right-click on an entry, or entries, in the Alarm Banner.

The User Accounts are already assigned a Default Alarm Filter, which applies when the users log on to ViewX or Virtual ViewX. Two further custom menu options are added to enable the users to either revert the Alarm Banner filtering back to their User Account's Default Alarm Filter, or remove all filtering from the Alarm Banner. (With this latter option, the Alarm Banner is set to include all alarms to which the logged-on User Account has access (other than alarms that are suppressed, or under the Exclusive Control of another user).) These two additional custom menu options enable the users to remove the regional-specific filtering once they no longer require the entries in the Alarm Banner to be filtered to only include 'High' or 'Critical' alarms for a specific region.

To provide the required custom menu options, the Root Group includes the following Global Script:

Public Sub BuildAlarmMenu

If AlarmBanner.SelectedAlarms.Count > 0 Then

AlarmBanner.AddMenuItem "High Alarms - Eastern Region","SetAlarmFilterEasternRegionHigh"

AlarmBanner.AddMenuItem "High Alarms - Northern Region","SetAlarmFilterNorthernRegionHigh"

AlarmBanner.AddMenuItem "High Alarms - Southern Region","SetAlarmFilterSouthernRegionHigh"

AlarmBanner.AddMenuItem "High Alarms - Western Region","SetAlarmFilterWesternRegionHigh"

AlarmBanner.AddMenuItem "Revert Back to Default Alarm Filter","UseDefaultAlarmFilter"

AlarmBanner.AddMenuItem "Remove All Filtering","RemoveAlarmFiltering"

End If

End Function

The above script is used to include the 6 custom options in the menu that is displayed whenever a user right-clicks on an entry in the Alarm Banner. If the user then selects one of those custom menu options, the script calls the function that applies the relevant filtering (or, in the case of the last menu option, removes all filtering) from the Alarm Banner.

Further script is used to restrict the entries in the Alarm Banner to just those 'High' or 'Critical' alarms that exist for a specific 'region' (database Group) in the database. Four sets of this script exist, one for each 'region'.

Public Sub SetAlarmFilterEasternRegionHigh

Dim ParseError

ParseError = AlarmBanner.SetFilterForSystem("Local", "Source=""Eastern Region.*""&MinSeverity=""667""")

If ParseError <> "" Then

MsgBox "Filter", "Failed to set the filter. Parse Error: " & ParseError

End If

End Sub

In the above script, the AlarmBanner.SetFilterForSystem function is used to specify the custom filter that is to be applied when the user selects the custom 'High Alarms - Eastern Region' menu option from the Alarm Banner. The name of the Geo SCADA Expert system (database) to which the filter is to apply is "Local". Notice that the whole set of filter criteria is enclosed within double straight quotation marks. Also notice that if multiple filter criteria are specified, an ampersand (&) is used to concatenate the entries. In the custom filter above, only alarms that exist in the 'Eastern Region' Group and have a 'High' Severity (or a 'Critical' Severity) will be included in the Alarm Banner when the 'High Alarms - Eastern Region' custom menu option is selected from the Alarm Banner. On the Geo SCADA Expert system, 'High' alarms have a Priority of 667 upwards (as specified in the Severities section of the Server Configuration Tool); this Priority is used in the Alarm Banner script. As the 'Critical' alarms have a higher severity than the 'High' alarms, these are also automatically included in the filter. (If only 'High' alarms were required, a MaxSeverity filter entry could be added to exclude 'Critical' alarms.)

Similar script exists for the other 3 regions for which alarms are to be filtered in the Alarm Banner.

As users are likely to want to revert back to their default version of the Alarm Banner once they have finished filtering to a particular 'region', they are provided with a 'Revert Back to Default Alarm Filter' custom menu option. The function that this menu option calls has the following script:

Public Sub UseDefaultAlarmFilter

Dim ParseError

ParseError = AlarmBanner.SetFilterForSystem("Local", AlarmBanner.DefaultFilter)

If ParseError <> "" Then

MsgBox "Filter", "Failed to set the filter. Parse Error: " & ParseError

End If

End Sub

The above script uses the AlarmBanner.DefaultFilter property to revert the Alarm Banner's filtering back to that of the logged-on User Account's Default Alarm Filter (see Define the Default Alarm Filter Settings for a User). (If the User Account does not have a Default Alarm Filter assigned, the routine will remove all filtering from the Alarm Banner.)

In some situations, it is envisaged that the user might want to remove filtering from the Alarm Banner altogether, so that they can view all alarms to which their User Account provides access (bearing in mind that any alarms that are suppressed or under the Exclusive Control of another user will not be included in the Alarm Banner). To enable users to remove all currently applied filtering from the Alarm Banner, a custom menu option 'Remove All Filtering' is provided. The function that this menu option calls has the following script:

Public Sub RemoveAlarmFiltering

Dim ParseError

ParseError = AlarmBanner.SetFilterForSystem("Local", "")

If ParseError <> "" Then

MsgBox "Filter", "Failed to set the filter. Parse Error: " & ParseError

End If

End Sub

With the above script, the AlarmBanner.SetFilterForSystem function is used to clear the filtering of alarms for the Geo SCADA Expert system (database) that is called "Local".

When users right-click on an entry or entries in the Alarm Banner, the context-sensitive menu includes the six custom menu options that are defined in the Global Script:

Users can select the custom menu options to apply or remove Alarm Banner filtering as required. As with other alarm filters, when a filter is applied, an 'F' is shown on the Alarm Bell Button to indicate that a filter is in place. The numbers shown on the Alarm Bell Button take into account the filtering that is in force. After applying any of the custom filters, users can select the custom 'Remove All Filtering' option to remove all filtering from the Alarm Banner and view other alarms to which their User Account provides access. Alternatively, they can select the 'Revert Back to Default Alarm Filter' custom option to revert the Alarm Banner filtering back to the Default Alarm Filter that applies to their User Account.

Notice that the 'standard' Reset Filter menu option is disabled while any predefined custom filtering is in force. This is because the Reset Filter option only removes filtering that has been applied using the 'standard' Filter option.

Further Information

Specify a Default Alarm Filter for a User Account.

Define the Default Alarm Filter Settings for a User.

Alarm Filter String Syntax.

AlarmBanner.DefaultFilter.

'Standard' menu options that are available from the Alarm Banner: see Alarm Banner.


Disclaimer

Geo SCADA Expert 2022