Email/Text alerts on non-tag based value change

I made a custom table that allows users to select a product, and input test data, which then has a button to send to a database. Depending on the value of the multi-selection drop down, I have a script that picks which database to send the data to. This is all working greatly, but what I want to look at now is notifications. So, the user input is not tied to a PLC tag or anything, which appears to be the primary source of the alarming functions. What I would like to do, is evaluate which database I am looking at so I know if the text field should be a string, integer, etc, then basically say If textfield >10 OR <2 , fire off this email/text showing out of range value. Or maybe the textfield would be PASS/Fail, so IF textfield = 'FAIL', send out alert. I am looking for an example of some kind of script to fire this, but also, I am unsure how to trigger the event. I only want to trigger if a product selected from the drop down, which is easy enough, but I also only want to trigger AFTER the text field has been interacted with and changed by a user. So, after the update for example, the text field will be written over back to blank. I would not want that change to trigger anything. User makes change -> Change is out of spec -> fire out alert.

Or is there any possibility of looking at the database itself and alarm on new entries out of a certain value or condition?

Thanks in advance.

You cannot generate your own alarm for the notification system. But you can use system.net.sendEmail in a script to send anything you want. There's also system.twilio.sendSms for text messages.

2 Likes

I think that is more so what I want to do. Would probably be easy enough to nest another IF statement within the existing ones on the "update" button. So, it sends to the database then also evaluates each condition and determines if it should send an email or text.

Appreciate this information, I will look for some examples of the syntax. Thanks!