Last time I discussed a topic / person in my dailies

Well, a challenge is a challenge:slight_smile:

But please be gentle and don’t push too much because I’m not a coder/programmer or similar (tech isn’t my field). I don’t even know how the script works (in code language and logic sense) and I’m a zero in javascript (which would certainly be more useful for solving this challenge).

But i’ll try my best, working only with DQL, by “try-error” method.

After some hard work, considering that commands are executed in order and can be used multiple times, I tried to play with FLATTEN, SORT, WHERE and GROUP BY.

I’m not sure if I understand well how flatten/group works (because the “rows” - here’s a proof of lack of knowledge on the language side and logic of the code), and I don’t know if the query is “bulletproof” or if it has some problems because the tests were limited.

Another thing. The query proposal implies this condition: your notes with tag #journal works like daily notes, i.e., the date valid to the query is the date that the file was created. This means that for the query the content is added in the day you created the file.

That said, try this:

```dataview
TABLE WITHOUT ID
	Person,
	rows.IN[0] + "<br>" + "<span style='font-size:13'>(" + dateformat(reverse(sort(rows.IN.file.ctime))[0], "yyyy-MM-dd") + " )</span>" as "Last Contact (date)",
	date(today) - reverse(sort(rows.IN.file.cday))[0] AS "Days since last contact",
	choice(date(today) - reverse(sort(rows.IN.file.cday))[0] >= default(Person.contact-frequency, " "), "Contact now", " ") AS "Call"
FROM #follow-up
FLATTEN file.inlinks as IN
SORT IN.file.ctime DESC
WHERE contains(IN.file.tags, "#journal")
GROUP BY file.link AS Person
SORT reverse(sort(rows.IN.file.ctime)) DESC
```

EDIT: I think the last SORT can be more simple, just:

SORT rows.IN.file.ctime DESC
2 Likes

In that case I think you need to separate the way you mention people.
Taking your example, you can try dataview in-line field to “mention”. Something like:

Called [[John]]. He said that [mention:: Mary] is not so well these days.

Notes:

  1. For in-line fields in dataview you can use two syntaxes: [key:: value] or (key:: value). In dataview settings you can enable “Inline Field Highlighting” and see the diferences between two (in the second syntax the “key” disappears in preview mode, presenting only the “value”)
  2. But maybe you want a link in Mary… But to differentiate between true contacts and mentions, you need to work with mention not as true backlink (identified as “outlink” or “inlink”). To do that, let’s create a (non)link with an inline-query inside the field:
Called [[John]]. He said that (mention:: `=link("Mary")`) is not so well these days.

(if enable “Inline Field Highlighting”)
image

  1. With this solution, this “mention” isn’t considered as a backlink to [[Mary]]. But maybe you want this list of mentions inside [[Mary]] file to have a list with all “mentions”. For that you can use this query (valid to all people file, because “this.file.name”):
## mentions
```dataview
LIST
WHERE contains(mention, this.file.name)
```
2 Likes

Great solution, and estremamente raffinata !.
I’ll grab some hint in order to populate my next Dataview queries.
Thanks @mnvwvnm!!!

1 Like

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