Got it! When writing dates with dots (2021.05.05), it works.
But not in ISO format (2021-05-05), which I thought Dataview needed for dates.
Weird.
Thanks for helping!
Is this because 2021.04.30 is seen by Dataview as a text, not a date?
And that one can’t use a contains command on a date, because it’s a date, not a text?
Just thinking out loud here.
In terms of integrating dataview queries in my daily notes, there are two things that are most important to me, and I’ve built them into my Daily Notes Template:
A query that will reveal all the notes created on or last modified on that day. For this, I use “file.day” to generate a query based on the YYYY-MM-DD title of any given daily note. The advantage is that this never changes.
A list of note titles that reflect every file that I’ve touched during that day. For this, “Last Modified” won’t work, since I might have created a note yesterday, work on it today, and then modify it again tomorrow. So I’ve resigned myself to doing a bit of manual review of the day (probably good to do anyway):
At the end of the evening, run the query (by switching to Preview mode) for a LIST of “last modified in the past 18 hours”
Copy the full list
Switch back to Edit mode.
Delete the dataview query
Paste-as-text the clipboard
Weed out unimportant files or modifications
Wrap as links particularly key notes
This gives me static, persistent record of the notes I worked on in a particular day. I could use the “Text Expander” plugin for this, but it relies on Obsidian search, which doesn’t yet include dates (I believe).
Here are the dataview queries I use, and include in my Daily Note Template:
For the query for everything created or last modified on the YYYY-MM-DD date in the Daily Note title, and that remains as a dataview query:
dataview
TABLE file.mday AS “Last Modified”, file.cday AS “Date Created”
WHERE (file.mday = this.file.day) OR (file.cday = this.file.day)
SORT file.mtime asc
Since I added a lot of new fields, I added them all under the field info because it was my understanding that we can do info.title and so on. Turns out, when I do that, it returns the entire list without any text but returns text for the one selected.
When I do just info in a table, this is what I get
Hey thanks for sharing that! I did run it through a validator since my YAML was being generated using a script and since it showed fine, I didn’t bother much further. I checked Dataview’s documentation and couldn’t find an example of something like this, so decided to jump in here. Bookmarking the parser as I’m sure I’ll be needing this again.
Re duration. Does anyone know if it is possible to get the Number used in a duration from a different field? So instead of dur(18 days) it’s dur(“DaysToHarvest” days)?
Is there any possibility to create a database of images?
How to add metadata to images?
In the github page of dataview plugin we can find in the roadmap the ‘future’ feature of “Gallery view (primarily for images)”… This means that is possible to add some metadata to images… Or it will only work with the ‘implicit atttributes’ (file.name, etc.)?
Any ideas how to display subtags (#tag1/tag2) as a single (and hence clickable) tag rather than two tags - one parent of the other tags in dataview tables?
// Family birthdays using DataviewJS
let pages = dv.pages("#family").where(p => p.birthday);
dv.table(["Name", "Birthday", "Age", "This year"],
pages.sort(p => moment(p.birthday.toString()).format("MM-DD"), 'asc')
.map(p => [
// The name
p.file.link,
// Formatted birthday from YAML frontmatter
moment(p.birthday.toString()).format("ddd, YYYY-MM-DD"),
// Current age in years
moment().diff(moment(p.birthday.toString()), 'years'),
// This year’s birthday as formatted date
moment(p.birthday.toString().substring(5, 10), "MM-DD").format("ddd, DD MMMM")]
)
);
Do you know if we are able to find the headings in backlinks? I’ve been trying to automate MOCs. Dataview seems to treat [[YouTube Channels#Coding]] the same as [[YouTube Channels#Obsidian]].
If Note A has [[YouTube Channels#Coding]] and Note B has [[YouTube Channels#Obsidan]]. A Dataview table searching for only [[YouTube Channels#Coding]] will show both. I’ve tried different where statements and contain statements.
In the table or list preview, it will display as “YouTube Channels” and then when I hover over it, it will show only the “Coding” section or only the “Obsidian” section.