Can the SQL search the file names?

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
Dellu
Posts: 271
Joined: Sun Mar 27, 2016 5:30 am

Can the SQL search the file names?

Post by Dellu »

I was trying to find the files which are not properly renamed.
user19 REGEX 'Anonymous'
doesn't get them. I want collect all the references which have attachments containing the name 'anonymous'.

Any way?
Dellu
Posts: 271
Joined: Sun Mar 27, 2016 5:30 am

Re: Can the SQL search the file names?

Post by Dellu »

OK, this one worked:

Code: Select all

Locate('Anonymous', varCharField) >0
based on the clue viewtopic.php?f=2&t=1984&p=9014&hilit=S ... name#p9014. I will leave it for reference.
Jon
Site Admin
Posts: 10292
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Can the SQL search the file names?

Post by Jon »

Correct. Note that the next Bookends update (12.8.1) will introduce an updated database engine and some refactoring of the database schema -- your search will no longer work. When using 12.8.1 and later you can use a similar search to the one you have, like this

Locate('Anonymous', attachments) > 0

This is fine, but it will match substrings as well (e.g. it will match this (fake) word 'Nonanonymous')

If you want a search that is case insensitive (like locate) and only matches full pdf names, you can use this (this is how you'd do it in our SQL search box):

attachments REGEX '(?im)^Anonymous.pdf$'

Jon
Sonny Software
Dellu
Posts: 271
Joined: Sun Mar 27, 2016 5:30 am

Re: Can the SQL search the file names?

Post by Dellu »

Ok, thank you. We will see when the new version comes out. I will ask if I couldn't find it right.
Post Reply