[SOLVED] Pulse - Notification if no result


#1

I wanted to setup a daily notification that only notifies me if there were no orders received the day before. so the query is straight forward, but the pulse configuration does only allow the notification to be sent always or limited to those which have a result.
in my case i exactly try the opposite. a notification that something might be wrong and a operator to look at the system.

having mails every day saying it is okay, thwat would be to much noise and nobody would really know that there might be an issue if none mail was sent.

does that make sense?
is there a possibility to only sent those mails if the result is 0 or empty?


#2

I’d use a stored procedure. Logic would be along the lines of returning a single record if the count of orders was zero. Otherwise return nothing.
Depends upon your database.
It might be possible to do something clever in a SQL query, but not something I’ve tried to do.


#3

Hi Andrew,

Thanks for your hint. i was stuck on the wrong end with my thinking
That was then way to easy to resolve

SELECT CASE WHEN orders.SUM = 0 THEN ‘no orders’ END AS information
FROM
(SELECT COUNT(order_id) FROM orders WHERE create BETWEEN …)


#4

Nice solution.