This is something I recently discovered, but an empty [[]] queries for pages linked to the current note:

list from [[]]
sort file.name asc
4 Likes

Aggregating all of my tasks into one note, sorted in a descending manner.

'''dataviewjs
dv.taskList(dv.pages().file.tasks
.where(t => !t.completed).sort(t => t.path, 'desc'))
'''
3 Likes

Absoloutly perfect!

1 Like

So I’ve just started using Dataview and discovered it has a Calendar display, and I’d like to use it to fetch a metadata field from daily notes and add it to that day in the calendar. I can do it, but what I can’t do is style the dots that appear in the calendar.

I want to have an “activities” field for each day which can have one or more activities, and then have a color coded dot or a symbol in the calendar for that day. Sort of what this plugin does GitHub - duoani/obsidian-habit-tracker: This plguin for Obsidian creates a simple month view for visualizing your punch records. but pulling it from within each daily note.

Is there any way to do this?

Quick update on my task aggregator, which is updated to ignore a specific page (ignore tasks in my Media note):

'''dataviewjs
dv.taskList(dv.pages().file
  .where(f => f.name != "Media")
  .tasks
  .where(t => !t.completed)
  .sort(t => t.path, 'desc'))
'''
1 Like

How do I always round down with Dataview? I’m calculating age with an inline field. Floor does not work.

= round((date(today) - this.Dob).years)

Try the following to see it it works for you:

`= round((date(today) - this.Dob).years - 0.5)`

This should be similar to how floor() works. You could add 0.5 to replicate ceil().

2 Likes

Works great, I was overthinking it, thanks!

Looking at this, it should be possible to search for parts of link titles. I have files named “1st Karlovy Vary IFF”, “2nd Karlovy Vary IFF”, etc. I want to list all notes linking to any of these by searching for “Karlovy Vary IFF” in a link. But this doesn’t work:

LIST
WHERE contains(file.outlinks, "Karlovy Vary IFF")

Why doesn’t this work? Can I only do this with dataviewjs?
Thanks!

@erazlogo, I was happy to explore this for you. You have already looked for the out links of the file, but now you need to say “only if its file name contains this text…”

file.outlinks.file.name

1 Like

@dryice Amazing, it works! Thank you so much!

1 Like

Hi there!
I am pretty new to Dataview and an absolute noob in JS, but I’m trying to create a time estimator in my “TO DO now” Kanban board.
Here is the example with Kanban board:

I implement here inline field annotation of tasks with =sum(filter(this.file.tasks.estimated_time, (p) => p)) to calculate time across ALL tasks with estimated_time field in the Kanban board.
But the problem is when I archive my old tasks → time from that tasks is still in use.
I’ve tried to filter field extraction according to section or header, but I’ve got no result. Usual field extraction by =this.estiamted_time also doesn’t work.
Maybe someone has genius ideas about it?

I am trying to accomplish something similar with my goal planning and projects execution.

My “goals” would correspond to the level of “year”, and “project” to “quarter”. In the goal YAML I included the project as a link to the note, as you do with quarters. The result renders the name of the project but not the link, ie. it’s not clickable. Can you please help me understand what need to be fixed?

Thanks, appreciate you sharing this set-up, it really clicks with how my brain works :slight_smile:

Have noticed that for the keys written with spaces in YAML, dataview cannot return results:

In the YAML sample, the key note type and MOC area have spaces

---
version: 1.00
title: Dataview manual
note type: tools for Obsidian
MOC area: Obsidian
cdate: 2022-02-15

tags: 
  - dataview
  - plugin
  - manual
---

If to change them to note_type and MOC_area have spaces, dataview works as desired.
Or am I doing something wrong?

In the hope that this helps…

Angel

1 Like

Thanks you - works now)))!

1 Like

Is there a way to bring the content of the page into the TABLE view? For example the book summaries of each highlighted paragraph. It would be great to be able to sort that content as well.
Table title, author, [[Summary]]
From #BookSumText

See Image.
Thank you
Snow

In order to easily reference which programming problems cover which topics I wrote this. It can easily be used for anything else by changing the filter tags. You can also get rid of the following :

  let include = new Set([
    "BFS","DFS","Recursion","Tree","Trie","Graph","Heap","Array","HashMap",
    "Set","LinkedList","GhostNodes","Sorting","SlidingWindow","Backtracking",
    "TopologicalSort","DP","TreeTraversal","BinarySearch"
  ].map((x) => `#${x}`));
tagMap.forEach((v, k) => {
    if (!include.has(k))
      tagMap.delete(k);
  });

If you want it to make tables for any tag.
Heres the snippet:

` ``dataviewjs
  var _a;
  let filtertags = ["programming", "problem"];
  let include = new Set([
    "BFS","DFS","Recursion","Tree","Trie","Graph","Heap","Array","HashMap",
    "Set","LinkedList","GhostNodes","Sorting","SlidingWindow","Backtracking",
    "TopologicalSort","DP","TreeTraversal","BinarySearch"
  ].map((x) => `#${x}`));
  let source = filtertags.map((tag) => `#${tag}`).join(" AND ");
  let files = dv.pages(`${source} AND -"00 Meta/06 Templates"`).map((p) => p.file);
  let tagMap = new Map();
  for (let page of files)
    for (let tag of page.tags) {
      let data = (_a = tagMap.get(tag)) != null ? _a : { tagnum: 0, pages: [] };
      data.tagnum++;
      data.pages.push(page);
      tagMap.set(tag, data);
    }
  filtertags.forEach((t) => tagMap.delete(`#${t}`));
  tagMap.forEach((v, k) => {
    if (!include.has(k))
      tagMap.delete(k);
  });
  let count = 1;
  let headers = [];
  let elements = [];
  let sorted = Array.from(tagMap.entries()).sort((a, b) => a[0].localeCompare(b[0]));
  for (let [tag, data] of sorted) {
    headers.push(`${tag.replace("#", "")} (${data.tagnum})`);
    elements.push(data.pages.map((p) => p.link));
    if (count++ % 3 == 0) {
      dv.table(headers, [elements]);
      headers = [], elements = [];
    }
  }
  if (headers.length > 0)
    dv.table(headers, [elements]);
` ``
1 Like

I’m very new to Dataview and I have a question about this.

I’d like to create a template where my Daily note shows me the files I’ve worked on today. What I want to know is - if I use WHERE date(now), will that keep updating and changing? So if it’s run on yesterday’s note, will it update and then show what’s edited today? Or will it continue to show what was edited yesterday?

In other words, do I need to set the WHERE bit relative to a specific date that’s pulled from “today”? Or will date(now) work to set the date so it doesn’t keep updating as time moves forward? Thanks!

Hi @melhopkop,

I don’t think à robust solution is possible.

Even if you made a formula “where date modified is today 2022-02-28”, if you modify any of the notes it retrieves at a later date, it will no longer show in your list.

A good solution would be dataview could “print” a static version of the table, ie the actual column headings, files and data list/table. But it would only really be useful if the table could be converted to a static form at 23:59 at the end of the day. And that sounds clunky!