Help: Email Only If......


Recommended Posts

Hello All,

Im still very new to this software and setting up pages, but im getting better. My configuration is basically using a LabJack to supervise relays and their states...

I was able to setup emailing, and every time a value is met, DAQ Sends an email. Only issue is that too many emails are being sent. So the statement i guess i"m trying to program is: Email only when a value is reached within the last 10 Minutes, Only once every 10 Minutes.. And include the Log of the events....

Im still having a problem with emailing the log, but its not as important as fixing my email issue...

Thanks in advance for everyones help, even if you only point me in the right direction..... :P

Link to comment
Share on other sites

There are a number of ways to do this, but I'd probably do it this way:

1) create a global string variable for storing your events. Lets call it just "events"

2) to add an event, do:

events[numrows(events)] = "my new event string"

this adds it to the end of the events variable

3) next create a sequence that every 10 minutes sends an email if there are any events. Here's the general framework:

while(1)
   delay(600) // wait 10 minutes
   if (numrows(events) > 0)
	  ... do email
   endif
endwhile

That way it only emails if there are events. Now, you'll likely want to list all the events in the email, so that scriptlet would look something like this:

email.strBody = "New Events:" + chr(13)
for (private i = 0, i < numrows(events), i++)
   email.strBody += events[i] + chr(13)
endfor
email.strBody = "---end of new events" + chr(13)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.