Search code examples
selectlotusscript

LotusScript - How to escape double quotes in the SELECT statement?


I have a multiple documents which are containing the field named organization.

Almost every second document contains double quotes in this field, for example: Medical Center "James Goodwin Corp." e.t.c

I have a search query with the name of some organization, which also contains quotes and trying to use this name in the search query to find all needed documents.

I have tryed many variants and each time I am getting the query syntax error about double quotes.

Can you please give some small example or some advise how to escape double quotes in the SELECT statement?

Thank you!

Update:

Yes, I am using Replace function like this:

searchValue = Replace(docByUi.search(0),{"},{|"|})

to change this double quotes to |"|. And I am getting an error in my select query Or maybe I am wrong in something?

Update #2:

My query looks like this:

query = {Form="Person" & @Contains(} & docByUi.fields(0) & {;"} & searchValue & {")}

I meaned that I am already using {} to create a part-to-part query.


Solution

  • You can use curly braces {} in your search statement. You don't need to escape double quotes inside braces.
    Here is example of your search query:

    Form = "Person" & @Contains(Level0; {Filia "Department of Y"})
    

    In your lotus script you can use | symbol to make your string:

    query$ = |Form="Person" & @Contains(| & docByUi.fields(0) & |; {| & searchValue & |})|