TABLE WITHOUT ID link(file.link, Date) AS "Date", Summary, Note
FROM "" AND !"900 Templates"
Where Author = "John Doe"
SORT Date ASC
The above doesn’t seem to work for me. It returns only 2 results. Results that do not even have the Date in YAML.
However if I add, Date to the columns, e.g.
TABLE WITHOUT ID link(file.link, Date) AS "Date", Date, Summary, Note
FROM "" AND !"900 Templates"
Where Author = "John Doe"
SORT Date ASC
I do get all my notes, but now I have two date columns. Also, the first date column are not links like I want it. Instead of the file name, I want to be able to click on the date.
Not sure why I’m getting this behavior in both cases.
What’s the format of your value in Date field? YYYY-MM-DD?
What’s your desired date format output? yyyy-MM-dd?
The question is: we can’t use directly Date as the second argument in link(A1, A2) - because a date. It’s necessary to “transform” this value in a string or similar. For example:
hmm. I may have bit off more than I can chew.
Yes, the date field is YYYY-MM-DD and my desired output is the same, but not sure what the difference is w/ the capital and non-capital versions.
I tried what you posted. E.g.
TABLE link(file.link, dateformat(Date, "yyyy-MM-dd")), Summary, Note
FROM "" AND !"900 Templates"
Where Author = "John Doe"
SORT Date DESC
see my previous post to output format. about the input format - “YYYY-MM-DD” -, this is a generic way to refer to “2022-04-08”. But for output format the tokens are important
Thanks for experiencing my issue before me, @romebot
FWIW @mnvwvnm - I came up with this issue not related to Dates & believe @romebot & my examples combined might suggest a Dataview bug. Will you kindly review?
To replicate (on v0.4.26):
Setup
Create file result 000000001.md with inline data
parents:: [[mission 000000003]]
class:: [[RESULTs]]
title:: "my lovely title"
Create file RESULTs.md to aggregate sub-files via DataView Table.
In RESULTS.md try various DataView combos using link()
default
TABLE parents.title, title
FROM ""
WHERE contains(class,this.file.link)
SORT parents.title, title
Verify link() works with LIST
LIST WITHOUT ID link(file.name, title)
FROM ""
WHERE contains(class,this.file.link)
SORT file.name DESC
Expect list() to work with TABLE
TABLE WITHOUT ID link(file.name, title), parents.id
FROM ""
WHERE contains(class,this.file.link)
SORT file.name DESC
Add in AS (as described in Description)
TABLE WITHOUT ID link(file.name, title) as OBS_FORUM_TEST, parents.title
FROM ""
WHERE contains(class,this.file.link)
SORT file.name DESC
I am not expecting to need AS since not written in documentation.
Hi.
What you describe isn’t a bug. In tables (not in lists) if you use only fields in the first line they’re used as the column names (parent or parent.title…). But if you use anything else - e.g. a function as link() - you need to add a new name to the column. That’s why you need to use AS.
But it’s not worth it explain more because the behavior will change in the next public releases. As you can see here - Release 0.5.3 · blacksmithgu/obsidian-dataview · GitHub - this will become optional.