Dataview error No implementation found for 'null - duration

Things I have tried

WHERE DateEngFormat >= date(file.day- dur(1 week)

What I’m trying to do

I am trying to create a table who display the habits of my daily notes in the last week of the date that was in Yamal “DateEngFormat”

---
aliases:  
tags:  
mod : '😞'  
DateEngFormat: 2022-09-20
title: ✍ الأربعاء20-09-2022
cssclass: dailynote
---
TABLE default(Habit_1, "❌") AS "Sleep", DateEngFormat
FROM "Journaling/Daily Notes"
WHERE DateEngFormat >= DateEngFormat  - dur(1 week)

Example :

DateEngFormat: 2022-09-29 (the same as the title of daily note in English format)

What I’m supposed to see

a table of habits from the last week ( 2022-09-22) to (2022-09-29)

What I see

Dataview: Every row during operation 'where' failed with an error; first 3:

                - No implementation found for 'null - duration'
- No implementation found for 'null - duration'
- No implementation found for 'null - duration'

What’s the used WHERE condition?
We see two:

  • WHERE DateEngFormat >= date(file.day- dur(1 week)
  • WHERE DateEngFormat >= DateEngFormat - dur(1 week)

The first one is wrong in multiple ways: maybe WHERE DateEngFormat >= file.day - dur(1 week)
The second is useless: it’s always true!

Another point is: maybe there’s a problem with the language used in your title and it’s not possible to extract the date in it (maybe because the text direction: from right to left). In that case maybe file.day doesn’t exist, then “null - duration” error

1 Like

The first one: WHERE DateEngFormat >= date(file. Day) - dur(1 week)

It’s wrong i agreed because I don’t understand how file. Day work
i thought the fille.day give you the date of the Note (the same date of calander when creating the note )

but i read this in other topic :

file. Day gets the date from:
1 - file title if any part have the format yyyy-mm-dd (for example: [[2022-02-17]] , [[My file with date 2022-02-17]] , [[2022-02-18 Friday]] , etc.)
2 - field named Date (if you use in your note a field as Date: 2022-02-18

so I change the “DateEngFormat” to “Date”
to use file. Day

---
aliases:  
tags:  
mod : '😞'  
Date: 2022-09-20
title: ✍ الأربعاء20-09-2022
cssclass: dailynote
---

and the dataview code to :

TABLE default(Habit_1, "❌") AS "Sleep", file.day
FROM "Journaling/Daily Notes"
WHERE file.day >= this.file.day - dur(1 week) AND file.day <=this.file.day
SORT file. day DESC

And then I got what I wanted :grin:

If you create a custom field named Date, then you don’t need (but you can) use file.day. You just can use directly Date:

WHERE Date >= this.Date - dur(1 week) AND Date <=this.Date

1 Like

Thanks for the information .
can i use this with any YML property ?

yes, you can use either implicit fields or custom fields.
For example:

TABLE default(Habit_1, "❌") AS "Sleep", Date, mod, title, file.etags AS Tags

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