SB first steps (queries)

Hi,

First steps with SB and I'd like to as for information (resources) about how to create "lua" querys.

I need a query for all notes into a folder, like a MOC (map of contents), only the main (first) level of the folder, not need to deep into all the contents.

Tried with:

${some(query[[
from p = index.subPages("01_PROYECTOS/1BAT/")
order by p.lastModified desc
limit 10 select templates.fullPageItem(p)
]]) or "Sin notas todavia!"}

and...

${some(query[[
from p = index.pages()
where p.page:startsWith("01_PROYECTOS")
order by p.pageLastModified desc
select templates.fullPageItem(p)
]]) or "Sin noticias de Gurb!"}

with not (good) results :frowning:

Please, advice.

How about ${widgets.subPages("01_PROYECTOS")}?

Thanks @Mike , but how can I obtain only files (notes) at the folder (1st level), withouth deeping into the tree structure(...)?.

Regards.

You could use something like this:

${query[[
  from p = index.pages()
  where string.startsWith(p.name, "01_PROYECTOS/") and not string.find(string.sub(p.name, #"01_PROYECTOS/" + 1), "/")
  ]]}

or

${query[[
  from p = index.subPages("01_PROYECTOS")
  where not string.find(string.sub(p.name, #"01_PROYECTOS" + 2), "/")
  ]]}

This filters out any subpages that have an additional / in the name (which indicates a subpage). Obviously, you could still add something like select templates.fullPageItem(p)

Great!, thanks a lot for your help.