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!

given the next md file

---
type: bookmarks
tags: #technology #noise
---
# Software
http://www.somewhere.com
http://www.somewhereelse.com
# Apps
http://www.othersomewhereelse.com

Is it possible to extract the links into a table with its heading?

Hi, If the name of your daily note is the today date, you could use:

.where(p => p.file.ctime.toFormat('yyyy-MM-dd') == dv.current().file.name)

As @dryice said, to keep the dataview table static you need to convert the dataview table to a Markdown table, you could use Dataviewjs script for creating Markdown table. Then copy the table at the end of the day. I think there is not an automatic solution for this.

I shared a snipped a few days ago that could be useful to you, you can find it here:

1 Like

I do something similar as my first task the following morning: take the results of a “new notes prior to today” data view query, copy/paste into a static block and done. Kind of a pain and frankly I’m not sure how useful it has proven to be,.

This is awesome. I’m assigning it to a hotkey, and planning to overhaul my vault around this kind of view.

I’ve been playing with Obsidian for almost a year and still don’t understand all the fuss about MOCs, if they aren’t automatically/dynamically generated. A lot of maintenance to add everything to an MOC and keep it up-to-date, ain’t it? (Compared to just tagging and knowing it will be in the the right place when I look for it). A manually generated table of contents seems like a step backwards in a world of databases.