Wildcard tag exclusions

Hi all,
Can’t seem to find a thread about this.
I have the following query:

${template.each(
  query[[
    from index.tag "task"
    where 
        not done
        and not due 
        and (pri > 1 and pri < 3 or not pri) 
        and not table.includes(tags, "grocery")
    order by pri desc
  ]], 
  templates.taskItemWithDuePri)}

Is there a way of excluding “nested” tags? ie grocery and grocery/test? Instead of adding and not table.includes(tags, "grocery/test"), I’d like something like startsWith for this but can’t find a way to make it work.

Thanks!

It doesn’t work because tags is a table and startsWith operator is for strings.

you need to extract the string from the table first so you can compare that.

try:

where not string.startsWith(tags[1] or "","grocery")

you need the or ""-part too, otherwise lua cant extract something from nil

Or

string.find( table.concat( tags or {}, “,”), “grossery” )

1 Like

you guys rock :slight_smile: