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

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

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