Fallback Dataset for empty sets

CMS Version

Version 4.3.1

Player Type

Preview show the issue allready

Player Version

Include the full version, including the revision number.

Issue

Hi,

I’m using Xibo’s internal database to display visitor names on a screen.
Each record contains a Date (Datum) and a Time range (Zeit, formatted as HH:MM-HH:MM).
The current query works – it shows the visitor’s name when the current date and time fall within the range:

SELECT *
FROM Eingang_Namen
WHERE STR_TO_DATE(`Datum`, '%d.%m.%Y') = CURDATE()
  AND STR_TO_DATE(
        CONCAT(`Datum`, ' ', SUBSTRING_INDEX(`Zeit`, '-', 1)),
        '%d.%m.%Y %H:%i'
      ) <= NOW()
  AND STR_TO_DATE(
        CONCAT(`Datum`, ' ', SUBSTRING_INDEX(`Zeit`, '-', -1)),
        '%d.%m.%Y %H:%i'
      ) >= NOW();

Problem
When there is no visitor scheduled for the current moment, I would like a fallback record (e.g. “No visitor scheduled”) to be displayed.

I could not find a way to define a fallback directly in a Text‑Dataset (the option exists only for the Calendar widget).

Work‑around attempts

A – Add an extra “empty” row

I added a row with NULL values for Datum and Zeit and tried to combine it with the original query using UNION ALL:

SELECT *
FROM Eingang_Namen
WHERE STR_TO_DATE(`Datum`, '%d.%m.%Y') = CURDATE()
  AND STR_TO_DATE(CONCAT(`Datum`, ' ', SUBSTRING_INDEX(`Zeit`, '-', 1)),
                  '%d.%m.%Y %H:%i') <= NOW()
  AND STR_TO_DATE(CONCAT(`Datum`, ' ', SUBSTRING_INDEX(`Zeit`, '-', -1)),
                  '%d.%m.%Y %H:%i') >= NOW()

UNION ALL

SELECT *
FROM Eingang_Namen
WHERE (`Datum` IS NULL OR `Zeit` IS NULL)
  AND NOT EXISTS (
        SELECT 1
        FROM Eingang_Namen AS t2
        WHERE STR_TO_DATE(t2.`Datum`, '%d.%m.%Y') = CURDATE()
          AND STR_TO_DATE(CONCAT(t2.`Datum`, ' ', SUBSTRING_INDEX(t2.`Zeit`, '-', 1)),
                          '%d.%m.%Y %H:%i') <= NOW()
          AND STR_TO_DATE(CONCAT(t2.`Datum`, ' ', SUBSTRING_INDEX(t2.`Zeit`, '-', -1)),
                          '%d.%m.%Y %H:%i') >= NOW()
      );

Xibo considers the query too complex and rejects it.

B – Duplicate the dataset

I created a second dataset record with the same fallback text and added another Text widget to the layout.
Unfortunately, Xibo applies the same SQL filter to every Text widget linked to that dataset, so changing the filter on one widget changes them all. This makes it impossible to have a dedicated fallback widget.

What I need

  1. A single, simple query (or Xibo‑supported method) that:

    • Returns the visitor record when the current date/time matches a scheduled entry.

    • Returns a predefined fallback record (e.g. “No visitor scheduled”) when no such entry exists.

  2. If a query‑only solution is not possible, any Xibo configuration tip (e.g. using a second layout, a hidden widget, or a different widget type) that reliably shows the fallback text only when the main query returns no rows.

Any advice, sample queries, or configuration tricks would be greatly appreciated!