If a dataview query is empty (list or table), there’s a very big block that takes up a lot of screen real estate (at least 8 lines worth) with the single statement:
“Dataview: No results to show for list query.”
For example, I have a query that is simply:
How can I suppress this?
I’m interested to know if there’s another way, but it’s easy with a
const notes = dv.pages('#this-week')
if (notes.length) dv.list(notes.file.link)
That will only show the list if there are matching notes, otherwise it will display nothing at all. You could change it to display some placeholder text if you like.
Just to add on to AlanG’s suggestion, an example for the placeholder would be one more line in the dataviewjs
else dv.paragraph("No results found!")
(remove the backticks around this when copy-pasting)
Apologies - you’ll need to change it to
#this_week with an underscore to match your tag.
Thank you, that worked, of course (I did change the tag to an underscore).
If you haven’t already, you might try turning off “Warn on Empty Result” in Dataview settings:
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.