Page 1 of 1

Filter to trigger with excluding a zone fails to exclude

Posted: Sat Mar 16, 2024 3:32 am
by GadgetChris
I'm trying to create an action for a trigger of one alarm zone and not another alarm zone:
zm-error-filter1.png
zm-error-filter1.png (21.38 KiB) Viewed 296 times
This is the debug:

Code: Select all

SQL SELECT E.,M.Name AS MonitorName,M.DefaultScale
FROM Monitors AS M INNER JOIN Events AS E ON (M.Id = E.MonitorId)
WHERE
E.TotScore > '30' and / AlarmedZoneId / EXISTS (SELECT * FROM Stats WHERE EventId=E.Id AND ZoneId=3 AND Score > 0) 
and / AlarmedZoneId */ EXISTS (SELECT * FROM Stats WHERE EventId=E.Id AND ZoneId=2 AND Score > 0) ORDER BY StartDateTime ASC
It looks like it's not register the negation. I've also tried does not match or does not contain, and none seem to create the correct SQL.
Should this not be Score = 0 ?

Thank you, Chris

Re: Filter to trigger with excluding a zone fails to exclude

Posted: Sun Mar 17, 2024 12:44 am
by iconnor
I never implemented the rest of the operators for this. I'll try to get to it soon.

Re: Filter to trigger with excluding a zone fails to exclude

Posted: Mon Mar 18, 2024 12:06 am
by GadgetChris
That would be great!
If you can give me a hint, I can try to do a pull request and have a go at it.
I've never looked at the code, but could give it a try...

Re: Filter to trigger with excluding a zone fails to exclude

Posted: Wed Mar 20, 2024 3:38 pm
by iconnor
In Filter.pm, around line 164 we force the op to EXISTS. Need to instead restrict it to valid values like NOT EXISTS etc.