Calc dueDate gets: No implementation found for 'array - null'

Hello,
when I try to subtract the due from today i get the error (in topic)

Things I have tried

I have projects like:

file: _P_1

---
projekt: _P_1
objekttype: Projekt
---

file: _P_2

---
projekt: _P_2
objekttype: Projekt

---

and action files:

file: _Aktion1__Pr_2

---
projekt: _P_2
objekttype: Aktion
due-date: 2022-11-12
state: đź“… geplant
---
projekt: [[_P_2]]

file: _Aktion2__Pr_1

---
projekt: _P_1
objekttype: Aktion
due-date: 2022-12-26
state: đź“… geplant
---
projekt: [[_P_1]]

What I’m trying to do

I simply want to calc the remaining days between due-date and today…
via:

TABLE  rows.file.link,
rows.file.frontmatter.due-date - date(today).days AS remain
where contains(state, "geplant") 
group by link(projekt)

but error occurs:

Dataview: Every row during final data extraction failed with an error; first 4:

            - No implementation found for 'array - null'
- No implementation found for 'array - null'
- No implementation found for 'array - null'

is there a possibility to get this via dataview or have I to solve this with dataviewJS… or is this not possibile?

would be nice if someone could explain me.
Thanks.

I don’t understand well the reason for the group by link(projekt) (projekt in the frontmatter or in the content? in content projekt: [[_P_2]] isn’t a valid format for dataview inline field)… but that isn’t the main question.
To answer directly, try:

TABLE
	rows.file.link,
	map(rows, (r) => (r.due-date - date(today)).days + " days") AS remain
where contains(state, "geplant") 
group by link(projekt)
1 Like

Thank you for your reply.

endless search and try of mine has an end…
It works fine.

…I don’t understand well the reason for the group by link(projekt)...

well, if I dont set the group by I’ll get:


anyway… your Code works!

there is only one thing…:wink:
How can I query the days, let’s say:

if days remaining <4 then
"🛑 " + map(rows, (r) => (r.due-date - date(today)).days)
else
":black_circle: " or something
it were too simple, if it works straight ahead :wink:
so when I do this:

TABLE
	rows.file.link,
	choice(
		map(rows, (r) => (r.due-date - date(today)).days) < 4,
		"🛑 " + map(rows, (r) => (r.due-date - date(today)).days),
		"âš« " + map(rows, (r) => (r.due-date - date(today)).days)
		)
where contains(state, "geplant") 
group by link(projekt)

he will spit this out:

maybe there is a simple solution to this?

regards

About the group by command, my observation is related with the target projekt: it works, but I just don’t understand if intentional - it works because the projekt field in frontmatter, not the projekt: [[_P_1]] in the content.

About your last question, I give you two queries to test (both works, but one is more “clean”):

1 - following the previous query:

TABLE
	rows.file.link AS Project,
	map(rows, (r) => (r.due-date - date(today)).days + " days") AS "Remaining days",
	map(rows, (r) => choice((r.due-date - date(today)).days < 4, "🛑 " + (r.due-date - date(today)).days, "⚫ " + (r.due-date - date(today)).days))  AS Priority
WHERE contains(state, "geplant")
GROUP BY link(projekt)

2 - using flatten to “build” a kind of variable:

TABLE
	rows.file.link AS Project,
	rows.left AS  AS "Remaining days",
	map(rows, (r) => choice(r.left < 4, "🛑 " + r.left, "⚫ " + r.left)) AS Priority
WHERE contains(state, "geplant")
FLATTEN (due-date - date(today)).days AS left
GROUP BY link(projekt)
1 Like

wow… thanks.
It was a bit more complicated than that… at least for me :wink:

version 2:

well, so much to learn for me.
I hope I can give something back someday.
thanks one more.

have a good night, You have earned it :raising_hand_man:

1 Like

Hello,
its me once again.
is there a chance to get a value from the project-file’s YAML-frontmatter into the view from above?
let’s say there is a entry in the project-file P_1:

---
symbol: 🔑
---

how do I get that thing right before the P_1 /P_2 project column?
That it loks like:

which syntax I have to use?
dataview would have to look for the value in “1” in that 1:n relation, as if I see this right…

two examples:

1 - symbols as autonomous column before the project column:

TABLE WITHOUT ID
	key.symbol AS "",
	key AS Projekt,
	rows.file.link AS Aktion,
	rows.left AS "Remaining days",
	map(rows, (r) => choice(r.left < 4, "🛑 " + r.left, "⚫ " + r.left)) AS Priority
WHERE contains(state, "geplant")
FLATTEN (due-date - date(today)).days AS left
GROUP BY link(projekt)

2 - joining symbol and Project link

TABLE WITHOUT ID
	default(key.symbol, "🪴") +  " " + key AS Projekt,
	rows.file.link AS Aktion,
	rows.left AS "Remaining days",
	map(rows, (r) => choice(r.left < 4, "🛑 " + r.left, "⚫ " + r.left)) AS Priority
WHERE contains(state, "geplant")
FLATTEN (due-date - date(today)).days AS left
GROUP BY link(projekt)

If you always have a symbol in each project, then you can replace default(key.symbol, "🪴") by only key.symbol. I just add this “:potted_plant:” to cases where there’s no symbol value and it will be replaced by this emoji (because “appearance” issues: if no symbol value the project link justify to the left of the line)