I’m using a Mac, and Dataview is converting “Command” to “Control,” so when I have a hotkey at uses Ctrl-Cmd, it is listed and Ctrl-Ctrl. And more importantly, if it’s Cmd-O, it’s listed as Ctrl-O.
Is there something I could change to have the queries account for the Mac’s command key?
Generally this works great but for some reason, when I make a new note today I get this error (but it does not happen in the notes I created for all days earlier in this week …):
Evaluation Error: TypeError: Cannot read properties of undefined (reading 'file')
at eval (eval at <anonymous> (eval at <anonymous> (app://obsidian.md/app.js:1:1444405)), <anonymous>:7:36)
at DataviewInlineApi.eval (eval at <anonymous> (app://obsidian.md/app.js:1:1444405), <anonymous>:15671:16)
at evalInContext (eval at <anonymous> (app://obsidian.md/app.js:1:1444405), <anonymous>:15672:7)
at asyncEvalInContext (eval at <anonymous> (app://obsidian.md/app.js:1:1444405), <anonymous>:15682:32)
at DataviewJSRenderer.render (eval at <anonymous> (app://obsidian.md/app.js:1:1444405), <anonymous>:16267:19)
at DataviewRefreshableRenderer.maybeRefresh (eval at <anonymous> (app://obsidian.md/app.js:1:1444405), <anonymous>:15995:26)
at HTMLDivElement.i (app://obsidian.md/app.js:1:138855)
I created a dictionary that pulls all “terms” and “definitions” from my vault, but when there are more than one term and definition, they are all placed in the same table cell.
I have this same question - it’s essentially like “flatten” in regular dataview, but I can’t for the life of me figure out how to do it into dataviewjs.
Could you provide a small data example? I’m rather new to dataview (and Obsidian) and unaware how you could get a ‘term’ property on your pages and how the resulting data structure look like :x
General speaking, dv.pages() return a data array that again has a function flatMap. Maybe you get the wanted result when you use flatMap instead of map?
Also, for debugging purposes, it can be helpful if you assign pages.sort(a => a.term,'asc').map(a => [a.term,a.definition]) to a variable and then add a console.log(variableName) to your query. Hitting shift ctrl I in Obsidian opens the developer console whereas you’ll see your console.log call.
This way you can investigate how your resulting table data looks like and how the data differs when you get a single row per term/definion or one row with multiple term/definitions.
This is very useful – thank you for sharing it. I already have a People folder, and in it the individuals have birthDate: in the yaml. Which bits of your template should I change to accommodate this?
Please tell me how can I learn about the obsidian dataviewjs plugin from the beginning. I am from a non-coding background and don’t know javascript. But I am interested in learning this plugin.
Hey! Trying to figure out how to do a combination of:
Display taskLists with groupByFile = true
Group the files of the taskLists by a custom YAML field
Filter out files of the taskLists by a custom YAML field
What I thought would work is:
for (let group of dv.pages().where(p => p.category.contains("project") && p.status.contains("active")).groupBy(p => p.kr)) {
dv.header(3, group.key);
dv.taskList(group.rows
.file
.tasks
.sort(t => t.completed))
;
}
It only works if I put something inside dv.pages(), and limit the contains() statement to a single filter, e.g. only .where(p => p.status.contains("active")). The thing is, I don’t have tags on the pages I’m filtering on (only YAML fields), and I’d prefer to filter with contains() statements on YAML than by adding tags.
My files I’m intending to query here look something like this
---
category: project
status: active
kr: [[Fly to mars]]
---
# Project
- [ ] Task
Hi, does anyone know how to use taskList, but have it not include sub-bullet-points located directly underneath the task? For example, I have tasks that are structured like this:
- [ ] Actual task that I want to appear in taskList
- Example contextual note I included as sub-bullets
- Note that these are not tasks / sub-tasks since they lack leading brackets
- However, taskList still displays them and makes the view too busy
I’ve noticed that those sub-bullet records are stored in the data array with a value for real equaling ‘false’. So I tried to filter for only real == true in the where section, but no luck.