Dataview query for a daily hub summary with specific inline fields

What I’m trying to do

Hello to everyone,
I am currently trying to create a Dataview query that summarizes the most important inline fields from my daily notes on a dashboard, the Daily Hub. The problem is that the list of mood fields is also displayed on days when no corresponding entries exist. I have already experimented with choice and nonnull, but I haven’t achieved a reasonable result yet.

Things I have tried

dataview
TABLE WITHOUT ID
file.link + "<br><strong>Summary</strong>: " + summary +
"<br><strong>Mood</strong>: " + "<ul><li>" + (join(nonnull(mood), "</li><li>") + "</li></ul>") AS Items
FROM "Journal"
WHERE mood OR summary
SORT file.name DESC
LIMIT 7

As I mentioned above, I would like to show the specific inline fields only if they are present on the corresponding day.

And here is the output so far…

Thanks for any hints in the right direction!

This should be doable if you encapsulate the whole building of the mood or summary string in a choice(nonnull(mood), " the whole thing", "")

Hi holroy,

many thanks for your answer and input!

Unfortunately, your suggestion does not lead to the desired result. For some reason, which I cannot explain, the entries are displayed twice with a “,” in between. Here is the result:

And here the query

TABLE WITHOUT ID
file.link + "<br><strong>Summary</strong>: " + summary +
(choice(nonnull(mood), "<br><strong>Mood</strong>: <ul><li>" + join(nonnull(mood), "</li><li>") + "</li></ul>", "")) AS Items
FROM "Journal"
WHERE mood OR summary
SORT file.name DESC
LIMIT 7

Any ideas?
Many thank!

It sounds like your mood property is a list. So if you had, say, four mood items on a particular day, the query you’re using would display the full list four times. Try this with unique to avoid duplicates:

```dataview
TABLE WITHOUT ID
file.link + "<br><strong>Summary</strong>: " + summary + unique(choice(mood, "<br><strong>Mood</strong>: <ul><li>" + join(mood, "</li><li>") + "</li></ul>", "")) AS Items
FROM "Journal"
WHERE mood OR summary
SORT file.name DESC
LIMIT 7
```

Hi dawni,

many thanks for your reply! With your addition, it now works like a charm.

Here is the updated query

```dataview
TABLE WITHOUT ID
file.link + "<br><strong>Summary</strong>: " + summary +
unique(choice(nonnull(mood), "<br><strong>Mood</strong>: <ul><li>" + join(nonnull(mood), "</li><li>") + "</li></ul>", "")) AS Items
FROM "Journal"
WHERE mood OR summary
SORT file.name DESC
LIMIT 7

And here is how it looks like

Many thanks to both of you for guiding me in the right direction!
Have a nice evening!