How to use DATAVIEWJS to limit the number of query entries

Things I have tried

What I’m trying to do

Hi, I’m trying to list five projects I’ve worked on recently, and I’m trying to use the limit() function when writing dataviewjs, but it’s reporting an error. I’d like to ask how to fix it and the correct format to write it. :cry: :pray:




Evaluation Error: TypeError: dv.pages(…).limit is not a function
at eval (eval at (eval at (app://, :2:31)
at DataviewInlineApi.eval (eval at (app://, :12386:16)
at evalInContext (eval at (app://, :12387:7)
at DataviewJSRenderer.eval (eval at (app://, :12877:17)
at ()
at eval (eval at (app://, :26:71)
at new Promise ()
at __awaiter (eval at (app://, :22:12)
at DataviewJSRenderer.render (eval at (app://, :12869:16)
at DataviewJSRenderer.eval (eval at (app://, :12864:28)


I’m more versatile in dql, not in js, but I think the issue is:

  • the logic must be “define what you want and, at the end, choose how to see it”;
  • you want the file links (file.links) from the list of pages in your folder “05_Projects”;
  • next, you want to see the results limited to 5 files and join them.

In your query you define the limit() before what you want (

Thanks for the reply! I tried putting the limit function after and the error report became

Evaluation Error: TypeError: dv.pages(...) is not a function

I’m not sure what’s going on.

Weird… It works for me.
And, as you can see in documentation, limit() is a function.
And if you use a slice() function?

  dv.pages('"05_Projects"')"", 5).join())

Is your plugin updated?

1 Like

Maybe because “” isn’t an array, maybe “file.links”.

Wow, slice() is working!
I confirmed the plugin version is 0.4.5…? I don’t know if it’s a version issue. I’ll update it later and try again.
Thank you very much for your help!

I tried but unfortunately it still didn’t work :cry:
Thank you for your reply!

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