How to add DPE and DP and SYSTEM name to the CommCenter Email Message

Find and share HowTos to various installations / configurations!
1 post • Page 1 of 1
eivanovic
Posts:78
Joined: Wed Sep 03, 2014 2:35 pm

How to add DPE and DP and SYSTEM name to the CommCenter Email Message

Post by eivanovic »

I was already asked twice how to add DPE or DP or System name to the Message text of an alert which is sent via CommCenter as an email. We do not have out of the box Keywords for this. But you can create your own keywords and add them in a hook functions.

Our Help describes how it could be done for the SMS to show specific messages. But this also applies for emails when using the hook functionality!
See the help under Add-ons -> Communciation Center -> Adaptivity of the Communication Center -> Modification of SMS texts before sending.

This can be done in following way for the DP and DPE etc...

1) Copy and paste the cc.cat (from the WinCC OA version) into your msg folder of the project.
2) In the cc.cat file in your project, search the MsgTemplate and add your addional keywords like "{AlertSYS}"for system and/OR "{AlertDPE}" for DPE and/or "{AlertDP}" for the DP.
The change in the cc.cat file would look like this:

Code: Select all

MsgTemplate,{AlertSYS}{AlertDPE} [AlertDescription] [AlertText] [AlertState] um [AlertTime], Wert ist [AlertValue]. [MsgState]
3) Now create a hook CTL as described in the help. The Hook CTL schould contain new key words and they should be replaced with the alert values:
The hook.ctl should look like this:

Code: Select all

void hook_ccModifyMessageText(string &text, atime alertTime)
{
  // Retreive the information for the place holders
  string aId = getAIdentifier(alertTime);   // Alert identifier
  string dp  = dpSubStr(aId, DPSUB_DP);     // Alert datapoint
  string dpe = dpSubStr(aId, DPSUB_DP_EL);  // Alert datapoint + element
  string sys = dpSubStr(aId, DPSUB_SYS);    // Alert system name

  // Replace the place holders with the actual values
  strreplace(text, "{AlertDP}",  dp);
  strreplace(text, "{AlertDPE}", dpe);
  strreplace(text, "{AlertSYS}", sys);
  
  DebugFN("CCHOOK", __FUNCTION__ + "(..., " + (string)alertTime + ") Returning: " + text);
}
4) Save and close the CTRL library.

5) Stop the WinCC OA project.

6) Load the created CTRL library by setting the entry( either in the /config/config.level file or the /config/config of the project directory):

Code: Select all

[ctrl_X]                    #X stands for the number of the CTRL managerwhich executes the ccController.ctl 
LoadCtrlLibs = "hook.ctl"  


7) Start the WinCC OA project.

Please see attached the hook.ctl and a small demo project, which was done for 3.13, to give you a guidence how and where to make the changes.

https://www.winccoa.com/fileadmin/image ... nter_3.zip https://www.winccoa.com/fileadmin/image ... ccHook.ctl

1 post • Page 1 of 1