Dataview query in a callout that defaults to closed if there are no results

What I’m trying to do

I want to have a DV query packaged in callout that only opens if there are any results.

I now have this:

> [!warning]+ Overdue
> ```dataview
> FROM #task
>   !completed
>   AND (due or scheduled)
>   AND default(scheduled, due) < date(today)
>   AND contains(tags, "task")
> GROUP BY default(scheduled, due) + ": " +
> ```

I guess I could put that all into dataviewjs and compose the callout based on the query result. Wondering if there was a “lighter” way? Maybe by “+”/“-” being generated in an inline query?

The better and easier solution is indeed to use dataviewjs, and add/modify headers based on the v result of the query.

You can still use the DQL query through dv.query, just delay the output until you’ve done the other stuff.

1 Like

Thanks. I sometimes find myself creating overly complex solutions, so have learned to check with more experienced folks if a simpler/better approach exists before diving down the rabbit hole!

Love the original idea, so if you ever emerge from the rabbit hole with the golden code, I would love to offer up some awe and wonder. :star_struck:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.