Alert if Trunk goes down?

Is there a way to alert if a critical port or trunk goes down? I was looking at the ifTrunk in the database table.
±---------±-------------±------------------±--------+
| ifName | ifOperStatus | ifOperStatus_prev | ifTrunk |
±---------±-------------±------------------±--------+
| Gi1/0/23 | down | up | NULL |
±---------±-------------±------------------±--------+
Right now the trunk is down, so says NULL
If the trunk was up it would say dot1Q.
For some reason when I set the alert
%ports.ifOperStatus = “down” && %ports.ifOperStatus_prev = “up” && %ports.ifTrunk = "NULL"
It doesn’t detect the NULL.

I test it in the database
select ifName, ifOperStatus, ifOperStatus_prev, ifTrunk from ports where device_id = ‘887’ && ifOperStatus = “down” && ifOperStatus_prev = “up” && ifTrunk = “NULL”;
and returns nothing.

If I change the condition to

MariaDB [librenms]> select ifName, ifOperStatus, ifOperStatus_prev, ifTrunk from ports where device_id = ‘887’ && ifOperStatus = “down” && ifOperStatus_prev = “up” && ifTrunk is NULL;
It detects the NULL.
But in librenms Alerts there is not “is” condition?
Hopefully im going about this the right way. Please Help.

Why not just do:
%ports.ifOperStatus = “down” && %ports.ifOperStatus_prev = “up” && %ports.ifTrunk != “dot1Q”

HI @Rosiak I was thinking about that, but if the device port isn’t configured as a trunk and just a regular access port. The field is blank. Would %ports.ifOperStatus = “down” && %ports.ifOperStatus_prev = “up” && %ports.ifTrunk != “dot1Q” && %ports.ifTrunk != “” work?