I want to calculate metadata with an inline equation and display it using a dataview.
I have a note template which referes to “To-Do”-Notes. The template contains following lines:
This displays for example: remaining::3 weeks
I want that the remaing time of this note will be displayed in a dataview. The dataview will be created like:
Table remaining as Remaining
The column remaining just displays “-”, while in the note, the inline equation is displayed with e. g. “3 weeks”
Things I have tried
I have tried several workarounds by calculating it with dataviewjs, but this solution above should work, but somehow does not.
This statement is not setting the inline field
remaining to be the remaining days of that particular todo, which is easily assumed. It’s actually setting the inline field of
remaining to be the actual query.
In some cases, this might work as you want it to, but in most cases it’ll not work. Especially if trying to use this value in another plugin or as base for some other stuff. In your case it’ll not work in a table on another page, as then the
this.due will try to lookup the
due field in the file where the query is being executed.
You need to do the calculation in the table itself, so try something like the following:
FLATTEN due - date(today) as Remaining
(You might need to use
date(due), but if it’s properly formatted, that shouldn’t be needed)
file. in front of the
Makes sense. Thank you very much! Worked for me with
Didn’t know, that you could calculate columns
Oopps… I did make a typo there. I shouldn’t have written
file.due. The variants to use should be either
due for the due variable in n any file of your query (like you do in
this.due when you want the due date of the current file.
With that out of the way. Does it work with just
due, and not
date(due)? It should do so, if the date is properly formatted.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.