How to replace dataview "no results" with a custom text string?

I’ve hunted high and low across this forum, reddit, the dataview docs and discussions and can’t find the answer to what seems like it should be a trivial operation, so I must abandon my lurkery ways and actually ask for help.

I’m creating a dashboard for my daily notes. It lists entries from each month. Currently, if there are no entries for a month, my options are the “Dataview: No results to show for list query” box or absolutely nuthin’.

What I want is for the null result to return as a text string, something like “No entries made in [month]”. (Or an image. Can I use an image? That would be cool.)

The query I’m using, if it’s relevant:

My instincts (those of an untutored goblin who has learned to code by picking up other people’s code and poking it suspiciously with a stick until I figure out why it does what it does) say there ought to be some way to say “IF null result THEN (“string of text”)” or something like that, but if there is some such thing in DQL I can’t find it.

I suspect, from the results I’ve encountered (links at bottom), that the answer is to be found in dataviewjs. Unfortunately, my experience with dataviewjs so far is “took more than an hour to work out the code to generate a list of notes; generated list of notes with every possible bit of data attached (creation date etc etc); got spooked and returned to DQL.”

TLDR:

  • Can I replace the dataview “No results” result with custom text (or image)
  • If this is possible in DQL, how?
  • If this is only possibly in Dataviewjs, can someone link me to an idiot’s beginner’s ELI5 guide to dataviewJS
    • or write me the snippet of code in which case you are my HERO
  • If this is not possible with either, can I use CSS somehow?

**Places I’ve looked
**
Obsidian docs, Dataview docs, Dataview github discussions, general searching of things like “dataview replace “no result,”” “dataview if then,” “dataview replace results with text,” etc.

Specific posts that seem adjacent to what I want:

https://www.reddit.com/r/ObsidianMD/comments/1bt6du2/is_there_a_way_to_change_dataview_output_if_there/

Thank you, gracias, merci, appreciated. I’ve been circling this specific tiny problem for two days and it’s slowly driving me bonkers.

Default dataview can’t replace empty msg.

If Qwen (AI) doesn’t lie, in HTML structure are different tags for query results and empty msg. Than you can write snippet like this using pseudoelements.

.dataview.no-results::after {
    content: "Нет данных для отображения" !important;
    color: #888;
    font-style: italic;
    display: block;
    padding: 1em;
}

.dataview.no-results {
    color: transparent !important;
}

I’m not shure if there is actual diff and can’t check now, sorry.

Other way you can use dvjs. Maintainer promice dvjs allows to do anything with data. Highly possible that’s nearly true. Good luck! Write here please if you find your way!