You are viewing limited content. For full access, please sign in.

Question

Question

Remove character from template field during search

asked on October 25, 2019 Show version history

Hello,

 

I've been stuck on this for a couple of days now. I'm trying to run a search against a template field, but need to strip the dashes from the field that's already in Laserfiche. The below syntax obviously doesn't work, but here's basically what I'm trying to do.

 

{[]:[REPLACE(MyFieldName, "-", "")]="123ABC"}

 

To better illustrate, here's how I would do it in SQL

SELECT ID FROM MyTable WHERE REPLACE(MyFieldName, '-', '') = '123ABC'

 

Any help is appreciated, thanks! :)

0 0

Replies

replied on October 28, 2019

I don't believe it's possible to do that with the search syntax. If it's necessary to remove the '-' you can always run operations against the underlying SQL tables.

Here is a link to download the whitepaper on advanced search syntax (it says 8.3 but it's still accurate): https://answers.laserfiche.com/files/downloader/81076?save=True

0 0
replied on February 4, 2020

If you need to act on a large number of search results, the best approach is to use an automation tool like workflow.

For example, you could search for documents that need reformatting, then use token editor in workflow to do the appropriate replacements.

What your search syntax is like depends on what the field values look like. If they are consistent, you can use a more specific search. If they vary a lot, you'll likely have to use the * wildcard on either side of a hyphen, like so:

{[]:[MyFieldName]="*-*"}

If you have a standard format, like 123-ABC, where it's always 3 digits, a hyphen, then 3 letters, you could do [0-9][0-9][0-9]-[a-z][a-z][a-z] for the search term:

{[]:[MyFieldName]="[0-9][0-9][0-9]-[a-z][a-z][a-z]"}

the [ ] square brackets mean "any single character", 0-9 limits it to digits 0-9, and a-z limits it to letters.

0 0
replied on February 5, 2020

Thanks. Unfortunately, I have to rely on the SDK alone.

0 0
replied on February 5, 2020

Just to clarify, is the root problem that your field data is not consistently formatted? I won't help in the short-term, but going forward you can take advantage of field constraints to enforce consistency.

0 0
replied on February 5, 2020

Yeah, we're dealing with multiple agencies who format their case numbers differently. We can't really force them, because it's how they have it in their systems, but sometimes files come in with or without dashes and it's not always consistent, so throwing them all out on both ends would just make this easier. That said, I will probably go through the backend database and do it that way :)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.