AdvancedHMI Software
General Category => Support Questions => Topic started by: PLCROBOTGUY1 on March 01, 2020, 09:46:34 AM
-
Hi All,
I have 2 questions about the email in AHMI
1. I need to be able to send an email with values IE. If a PV goes High send that high value to QA
2.I have the email function working but it runs once when I start up the HMI. I don't want it to do this because the computer that its on is shutoff at night.
Thanks
-
You may be able to handle the ValueChanged event and modify the MessageBody property like this to insert values:
Private Sub Emailer1_ValueChanged(sender As Object, e As EventArgs) Handles Emailer1.ValueChanged
Emailer1.MessageBody = "Current Value=" & EthernetIPforCLXCom1.Read("MyTag")
End Sub
The initial send is caused by the control not knowing the existing value, so when it starts up, it can only assume the value changed. In the upcoming Beta 35, there will be a fix to prevent this.
-
IN the PLC, you'd setup PV> HV then TriggerSend
in the AAHMI, setup an event to catch the TriggerSend bit, and capture your PV value, then send email to your favorite QA.
Looks like Archie just beat me.
-
You may be able to handle the ValueChanged event and modify the MessageBody property like this to insert values:
Private Sub Emailer1_ValueChanged(sender As Object, e As EventArgs) Handles Emailer1.ValueChanged
Emailer1.MessageBody = "Current Value=" & EthernetIPforCLXCom1.Read("MyTag")
End Sub
The initial send is caused by the control not knowing the existing value, so when it starts up, it can only assume the value changed. In the upcoming Beta 35, there will be a fix to prevent this.
Thanks this worked but not with my SLC 500
Emailer1.MessageBody = "PV HIGH!=" & EthernetIPforSLCMicroCom15.Read("Nxx:xx")
I get the message below
System.NullReferenceException: 'Object reference not set to an instance of an object.'
-
Could use the Inner Exception to debug where the issue is better. When that comes up, look on the Exception Handler dialog for the "See Inner Exception" and post that information.
-
Null Reference could indicate that either the code is executed before the connection to the PLC is established or before the EthernetIPforSLCMicroCom15 is created.
Or maybe the address "Nxx:xx" does not exist.
-
Ok got this working with the Above code but the value only updates when i run a debug. When i trigger the email it sends the last values from the last start up. Fixed the error my plc was not connected.
Emailer1.MessageBody = "Current Value=" & EthernetIPforCLXCom1.Read("MyTag")
-
EthernetIPforCLXCom1.Read("MyTag") doesn't really do anything else but ask the PLC to provide a value that's currently in "MyTag".
If it is the last values from the last start up then that's what is currently in the PLC.