Dataview plugin snippet showcase

Hmm it looks ok to me. Are you getting any output at all?

Is there a way to get file.mtime in ā€œX days agoā€ format ?

Are you aware if thereā€™s a way to query the vault for, all notes which contains a certain word in the title?

@paoloap

LIST
FROM ""
WHERE contains(title,"your_preferred_word")

This searches your filesā€™ titles (as defined in the fileā€™s metadata). If you are looking for file names, then adjust the last line of the code as follows:

WHERE contains(file.name,"your_preferred_word")

5 Likes

Don, this works great, Thanks! dataviewjs is a total blindspot for me, Iā€™m not a dev.

P.s. how could I add an ā€œorā€ operator this snippet? Iā€™d like the option of tagging with either #WaitingFor or the hourglass emoji.

This query searches in all Dataview in-line fields ā€œtitle::ā€, but not in the note titles.

Yes - thatā€™s what is meant by ā€œtitleā€ (at least in my understanding) :wink:

But thanks anyway - I edited my above post to avoid misunderstandings.

1 Like

thanks a lot, super helpful!!

Anyone know if it is possible to open the CALENDAR query to a specific month/year? It opens to the current month by default, even if the where clause only references older notes.

IE:

CALENDAR file.mtime
FROM ""
WHERE date(file.mtime).month = date(2022-04-01).month AND date(file.mtime).year = date(2022-04-01).year
1 Like

I think a simlple way is to use Number.
First, I think we donā€™t need the year and the day ,we only need month.
So,there are two ways :slight_smile:

  1. 0 >= date(today).month - birthday.month >= -2
  2. date(today).month - birthday.month >= 10 for Dec,Nov to Jan,Feb

You can use that in where and connect by ā€œandā€ ā€œorā€.Maybe itā€™s easier to understand and maintenance.

Hi everyone. I am developing a Notionā€™s like database using data view as search engine. I want to support inline fields edition but it is necessary to filter with the data view api just the inline fields. Is this feature supported?

thank you!

6 Likes

Anyone knows how to skip non-exist note in the FROM statementļ¼Ÿ

I want to review my bad habit in my weekly note, yet I wasnā€™t writing journal everyday. As a result, I always get a prompt complaining about dataview could not resolve link during link lookup.

I used to create the notes I missed manually but it gets more and more annoying as my vault is full of empty journal notes now. So, I am wondering if there is a good way to skip the note that doesnā€™t existļ¼Ÿ

Here is the query I wrote.

list
FROM  
	outgoing([[2022-05-16]])
	or outgoing([[2022-05-17]])
	or outgoing([[2022-05-18]])
	or outgoing([[2022-05-19]])
	or outgoing([[2022-05-20]])
	or outgoing([[2022-05-21]])
	or outgoing([[2022-05-22]])
	and #Habit 

And can dataview make a selection based on tags that have a dot in their composition.

I get this error



Dataview: Error: 
-- PARSING FAILED --------------------------------------------------

  1 | TABLE WITHOUT ID link(file.link, title) AS "ŠøŠ¼Ń Š·Š°Š¼ŠµŃ‚ŠŗŠø", status AS "стŠ°Ń‚ŃƒŃ", priority as "ŠæрŠøŠ¾Ń€ŠøтŠµŃ‚", starttask as "Š½Š°Ń‡Š°Ń‚Š¾", duedate as "Š·Š°ŠŗŠ¾Š½Ń‡Šøть Šŗ" 
> 2 | from ( #Š·Š°Š“Š°Ń‡Šø_Š²_firmc or #firmc ) and -#сŠµŃ€Š²Šøс and #m2m.firm.ru
    |                                                         ^
  3 | sort starttask DESC

Expected one of the following: 

'and' or 'or', /FROM/i, EOF, FLATTEN <value> [AS <name>], GROUP BY <value> [AS <name>], LIMIT <value>, SORT field [ASC/DESC], WHERE <expression>, text

Can you tell me what the ā€œconst data =ā€ statement would look like for this simple selection? My goal is to build a graph from the simple select but I need help with the syntax. Thank you :pray: :pray: :pray:

TABLE Rating as Rt from ā€œDaily-Documentā€ WHERE Rating != null SORT file.name DESC

I have the exact same question as you. Have you found the answer yet? (with Dataview I mean)

How do you keep it from showing every day instead of just the days with symptoms tracked?

No. I donā€™t have the answer yet. It seems like other people know how to do this. There have been a few examples but I have not seen the code yet. Chart - yes - code no. It is holding me up from developing a cool dashboard. Is there anyone that can help us out? Thank you :pray: :pray: :pray:

1 Like

Hi @Saorsa, if I understand what you are asking then that is easy. You just use the != null

Here is my data view for ā€œRatingā€. I rate most days and this excludes the days I forget. The data comes back perfect and it would be great to be able to create a bar chart by week and month so I can visualize the rating over time. If you see any code like that let me know. Thank you

LIST Rating
FROM "MobNotes"
Where Rating != null
SORT file.name DESC

Thank you for your your response. Originally I had the following

list link(rows.file.link, rows.symptoms) 
from "03 Cycles/Yearly Navigation Note/daily" 
group by dateformat(file.day, "DDDD") as Date 
where any(rows.symptoms) 
sort rows.file.ctime desc

which give me

So, I tried your suggestion as follows

list link(rows.file.link, rows.symptoms) 
from "03 Cycles/Yearly Navigation Note/daily" 
group by dateformat(file.day, "DDDD") as Date 
where any(rows.symptoms) 
where Symptoms != null
sort rows.file.ctime desc

which gives me

I canā€™t figure out why it wonā€™t work

1 Like

Quick note: The order of your operations matters: starting with FROM they happen top to bottom. (The first line, with list, is special since it controls the display of things after you have found them.) Your line with where Symptoms != null should come right after the FROM line, before the groupby. I donā€™t know if that will solve everything, but hopefully itā€™ll get you closer to solving it!

1 Like