SQL Like query, how to make it on DataView?

I just got started with DataView and would like to list all the files where the name starts with a given constant value.

How can get this to work with DataView?
Here’s my broken query.
Note that I have added extra spaces in the single quotes there just to help is visualise on the forum post. Remove them if you copy this query straight.

 ` ` `dataview
 LIST
 WHERE file.name LIKE "DataView Learning%"
 ` ` `

This obviously incorrect. Results error:

Dataview: Error: 
-- PARSING FAILED --------------------------------------------------

  1 | LIST
> 2 | WHERE file.name LIKE "DataView Learning%"
    |                 ^

Expected one of the following: 

'*' or '/' or '%', '+' or '-', '>=' or '<=' or '!=' or '=' or '>' or '<', 'and' or 'or', /FROM/i, EOF, FLATTEN <value> [AS <name>], GROUP BY <value> [AS <name>], LIMIT <value>, Not a comment, SORT field [ASC/DESC], WHERE <expression>, whitespace

Use WHERE startswith(file.name, "DataView Learning"). See startswith().

1 Like