Script to filter alerts

Find and share HowTos to various installations / configurations!
Search

Post Reply
11 posts • Page 1 of 2
najoua
Posts: 26
Joined: Fri Nov 27, 2015 10:21 am

Script to filter alerts

Post by najoua »

Hello,

I have added a combo box "Priority" above my AEScreen to filter alerts by priority. I want to add a script to the event "Changed" of my combo box. May I have an example of script to filter alerts ? I really need to do this by script because I will have to add other filters and then use the same logic.


Thanks,

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: Script to filter alerts

Post by leoknipp »

Hello,

if you want to apply a specific filter for the alerts in the AEScreen you have to use some (undocumented) internal functions for the AEScreen.
The settings for the AEScreen are written to an internal datapoint. The AEScreen reacts on the settings and starts a new query again with the new filter settings.

There is no simple example available how to change the settings and to restart the AEScreen.
If the AEScreen shall be opened with a specific filter the function openAES() is used. The configuration which is passed as parameter is defined at the panel System Management --> Settings --> A&E - Row/Screen.

For details please have a look at the online help.

Best Regards
Leopold Knipp
Senior Support Specialist

a_labropoulos@akatt.gr
Posts: 25
Joined: Sun Nov 06, 2016 2:02 pm

Re: Script to filter alerts

Post by a_labropoulos@akatt.gr »

Hello.

I am trying to find a way to insert specific filter to the AES screen. For example when i push a button i want to open the AES with openAES() Command with my configuration, but in my configuration and in the DPlist filter i like to put a specific Datapoint name and the AES showing the alerts only for this DP.
is this possible ;;

Thanks a lot.

User avatar
fmulder
Posts: 330
Joined: Wed Feb 03, 2010 9:46 am

Re: Script to filter alerts

Post by fmulder »

Yes it is possible and yes there is an example.
The Lab Section holds a document 'XFile 10 - The Alarm'.
It will show how to define a custom AES definition and how to open it

Good luck

Share the fun
Frenk Mulder

a_labropoulos@akatt.gr
Posts: 25
Joined: Sun Nov 06, 2016 2:02 pm

Re: Script to filter alerts

Post by a_labropoulos@akatt.gr »

Thanks you very much Frenk Mulder , filters works perfect for my AES Screen.
Now i have an other issue. I want to insert a column to my AES Row that shows the full user name (not user ID) when i acknowledge an alert.
Is this possible using add_value parameter or is an other easier solution.

User avatar
fmulder
Posts: 330
Joined: Wed Feb 03, 2010 9:46 am

Re: Script to filter alerts

Post by fmulder »

I'm sorry. I'm afraid that there is no 'simple' solution.
The C++ API has an example called 'SampleTabUtil' that is used to implement additional columns in the AES table.

The most efficient way and the one that will cost you the least amount of time, is implementing the SampleTabutil. If you decide to make your own alarm screen, then you will probably spend much more time ! Building an alarm screen is not easy !

Good luck

Frenk

ewoenne
Posts: 62
Joined: Thu May 12, 2016 10:35 am

Re: Script to filter alerts

Post by ewoenne »

Hi, we're after the same functionality, showing the user name that has acknowledged the alert on the alarm screen. Are there any plans to add this in a future version?

Thanks,
Ellen

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: Script to filter alerts

Post by leoknipp »

It is planned for a future version.
When it will be implemented is not defined right now.

Best Regards
Leopold Knipp
Senior Support Specialist

User avatar
fmulder
Posts: 330
Joined: Wed Feb 03, 2010 9:46 am

Re: Script to filter alerts

Post by fmulder »

Again. This is something that you can 'easily' do by yourself but You'll have to use Visual Studio to compile the AESTabUtil.

* Check out the lab section and look at XFile number 5 'The extension'. It will show you how you compile stuff using the WinCC OA API
* Look at : C:\\Siemens\\Automation\\WinCC_OA\\3.14\\api\\SampleTabUtil. File SampleTabUtil.cxx for an example
* Look in the help file and search for "Example of how to add a user-defined column"

In your case:
* You'll have to pass _alert_hdl.._ack_user to the function in your(!) AESTabUtil
* You can use the C++ method Manager::getUserName() to turn the integer into a string

Hope this points you in the right direction. The C++ AESTabutil is the most performant way to do this.

Can it also be done using scripting ?

Yes, I actually think that you could. When you check out the AES.ctl script code then you'll find !

Code: Select all

  res=convertAlertTabEx2( tab, g_configSettings, g_configMatrix, xtab, xtab2, diFontAttr );

  //DebugTN(__FUNCTION__,__LINE__,"result of convertAlertTabEx2",dynlen(xtab[1]),dynlen(xtab[2])); 

  //new feature 'userdepending alarm display' IM #117931
  if(isFunctionDefined("aes_editAlertsBeforeDisplay") &&(screenType != AESTYPE_EVENTS))
    aes_editAlertsBeforeDisplay(g_configMatrix, xtab);
This means that could implement a script function called 'editAlertsBeforeDisplay' and it allows you to modify the columns of the alerts before they are being sent to the AES table. You'll have to check out the contents of the variable 'gconfigMatrix' (to figure out what column to change) and then modify the 'cells' in xtab !

Hope this helps

Share the fun !
Frenk Mulder

Mgiacome
Posts: 20
Joined: Thu Sep 26, 2024 1:35 pm

Re: Script to filter alerts

Post by Mgiacome »

fmulder wrote: Thu Nov 10, 2016 1:08 pm Yes it is possible and yes there is an example.
The Lab Section holds a document 'XFile 10 - The Alarm'.
It will show how to define a custom AES definition and how to open it

Good luck

Share the fun
Frenk Mulder
Hi, I've found this topic cause I'll need to customize a filter on openAES function, but I cannot find the XFile 10 mentioned or any useful example.

thanks

Post Reply
11 posts • Page 1 of 2