# Email script trigger help

**URL:** <https://forum.inductiveautomation.com/t/email-script-trigger-help/78447>\
**Category:** Ignition\
**Created:** [August 28, 2023, 1:45pm UTC](https://forum.inductiveautomation.com/t/email-script-trigger-help/78447 "2023-08-28T13:45:48Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [August 28, 2023, 2:09pm UTC](https://forum.inductiveautomation.com/t/email-script-trigger-help/78447/6 "2023-08-28T14:09:24Z")

</div>

Thanks, that initialChange boolean will help me filter some.

I am thinking that I might set a query tag up to read the top row, and if the initialChange bit is false, then compare to a memory tag, send the email if no match, then write to the tag.

If there is no change, or the initialChange bit is true, then I won't send an email.  
I am a little concerned I might miss a change though in that case.

I could look at the timestamp, and email when it changes.

* * *

> [@bschroeder](#):
>
> Do you want to track any specific value in the row? Or that all values have changed?

At the end of a shift, if they did great then I insert a new row.  
I am to send an email to a manager, so they know.  
I could look at just the timestamp or the whole row.

* * *

Well I have many machines, it probably is even more complex.  
But maybe it makes it simpler.  
Maybe I just set a timestamp of when I last sent an email, and send an email of any times since the last timestamp.

Do I create a table of sent events, and compare my list to that?  
I am kind of thinking maybe that is easier, but also maybe silly.  
I can't tell if I am over thinking it or it is an ideal usage for tables.

* * *

I think I will do two table, checked periodically.

```auto
SELECT table1.*
FROM table1
LEFT JOIN table2 ON table1.key_column = table2.key_column
WHERE table2.key_column IS NULL;

```

I also plan to use code from here, to pack the data up into a csv to email.  
[Export dataset to CSV and send as email attachment - #8 by jmacascas](https://forum.inductiveautomation.com/t/export-dataset-to-csv-and-send-as-email-attachment/36529/8)]

---

_[View the full topic](https://forum.inductiveautomation.com/t/email-script-trigger-help/78447)._
