Generate report when a tag reaches a value

Hello, I would like to know if anyone knows if it is possible to generate an automatic report when a tag reaches a certain value. For example, if in a tag I am having a reading of values ​​but the reading drops to 0, a pdf report is generated. I was watching the videos of the course but I couldn’t find how to do it.

Gateway tag I am assuming?

Make a gateway tag change event on that tag. Then there you can do something like

if not initialChange and event.newValue < 0:
    # Make report logic

I think you’ll want this function for your report creation logic

One potential issue with this approach I can see is if its possible where it bounces above zero and down over and over, it may make many reports in a short time. If that’s ok with you then nothing wrong with this approach.