Help modifying simple data view queries

What I’m trying to do

Create simple queries to create lists or tables of my most recently updated notes and most recently created notes based on the updated and created properties.

Things I have tried

Many example queries from the forum and other websites.

Try this:

TABLE dateformat(file.mtime, "dd.MM.yyyy - HH:mm") AS "Last modified"
 FROM "" S
SORT file.mtime DESC LIMIT 25 

This is very close to what I’m looking for but I’m interested in the following modifications.:

Remove the item count in parenthesis from the first column heading.

Use created and update properties instead of file.mtime.

Create it as a list (if possible) in the format Title (created/updated date).

1 Like

To remove the item count goto Settings > Dataview > General and toggle off the Display result count. This will remove that number from all dataview tables.

To create a list using the updated property instead of the file.mtime would just be to replace the variable:

```dataview
TABLE dateformat(updated, "dd.MM.yyyy - HH:mm") AS "Last modified"
SORT updated DESC LIMIT 25
```

If you want to somehow combine the updated and created property, you need to explain which date should take precedence in the sorting. If you just want to add the other date, then you could just do:

```dataview
TABLE dateformat(updated, "dd.MM.yyyy - HH:mm") AS "Last modified",
  dateformat(created, "dd.MM.yyyy - HH:mm") AS "Created"
SORT updated DESC
LIMIT 25
```

If you want the 30 last operations combining the update and create action, you could do something like the following (using the file.ctime or file.mtime):

```dataview
TABLE change[0] as "Action", change[1] as "Date"
FLATTEN list(
  list("modified", file.mtime),
  list("created", file.ctime)) as change
SORT change[1] DESC
LIMIT 30
```
My output of this query

Note how almost all files have corresponding entries as I tend to create and modify test files almost at the same time.

To accomodate for you date format, and using the properties updated and created this query would look like:

```dataview
TABLE change[0] as "Action", dateformat(change[1], "dd.MM.yyyy - HH:mm") as "Date"
FLATTEN list(
  list("updated", updated),
  list("created", created)) as change
SORT change[1]
LIMIT 30
```

I probably had a typo or unclear explanation, I didn’t mean to combine them I meant to have one list of new notes and one list of recently modified notes. This helps a lot. Thanks.

1 Like

Hehe… Then just use the first query I presented, and I thought separate lists was what you meant, but once I started thinking about the concept of combining them I kind of had to do it for my own sanity. :smiley:

1 Like

That’s also kind of a good idea and now I’m debating using that instead but if so I think it needs some kind of descriptor or indicator about whether it’s new or updated if not separate lists?

Do you know how to mark the solution or is that something only the admins can do?

Anyway, thanks a lot.

The combined query do list whether the change was due to being updated or created, so it do report what caused its appearance.

1 Like

To mark a solution you hit one of the icons right next to the like icon. If the solution icon doesn’t show, then hit the triple dot icon to reveal all icons.


I don’t seem to have the option for solution. But I just realized I’m not the original poster and probably only they can do that. I had similar issues and a million tabs opened and realized this wasn’t my question. :smiley:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.