Expression Example - Email on Machine Alarm
Previous Topic  Next Topic 


Overview


This example will show how to send an email when a machine goes into an alarm.  The assumptions are that the appropriate users have their email addresses assigned to them which is done on the Manage tab on the Users form.


The next step is to define the Email Template which is done from the DataXchange tab using the Email button in the Template section of the ribbon bar.  Select the appropriate users to receive the email and define the subject and body of the email as desired.  From the PCS Database button in the ribbon bar the PCSDB.Equipment variable should be used to provide the Equipment name, and from the Focas button the Focas.alarm_detail variable should be used to provide the alarm number and message.



Next create an expression that will trigger the email. Now we need to connect to the DataXchange Service which is done from the DataXchange tab and the Connect button. For general information on the DataXchange Service refer to the DataXchange Service and DataXchange Interface help pages. 


On the DataXchange tab press the Expression button and then Create Expressions to bring up the Expression Builder. Press the Add button to create the new expression. Click in the Expression text box to enable the buttons in the ribbon bar and use the Focus variables to create the expression as shown below, or type directly in the Expression text box.


The Focas.alarm_status variable identifies if any NC alarm is active. In this case we only want to trigger an email when the control goes from not being in an alarm to being in an alarm. Select the Target of Email then select the associated Email Template.



Once the expression has been created it must be assigned to the desired equipment. From the main DataXchange screen select the equipment in the Equipment Tree, stop the command if it is active, and then press the Expressions button in the ribbon bar and select Assign Expressions.


Select the newly created expressions from the list and press the Assign button


.