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