I am running a db.search (not full text) on a database with the following formula Form = “Issue” & I_Comp = “SM&T”
The problem that occurs is that the “&” in “SM&T” is not recognized and the search returns no records even though I know some are there. Is there any method by which I can use an ampersand in a search formula as part of a text string ?
Subject: RE: Are you sure it is the &?
Hi,
I am not sure I understand your comment. You tried
Form = “Issue” & @Like(I_Comp;“SM%”)
and it found the document? This would support your theory. If it did not find the document, than this would contradict your theory.
Best regards
Mario Varchmin
http://www.e-llennium.com/e-llennium/index_en.htm
Subject: RE: Are you sure it is the &?
Thank you again Mario.I did try it and it didn’t work. I am certain it is the “&”.
Subject: RE: Are you sure it is the &?
What is “it”? What did you try and what did not work? Please be more specific!
Subject: Are you sure it is the &?
Hi,
are you saying Form = “Issue” & @Like(I_Comp;“SM%”) would find the document? If yes, it could be the &, if not, it is not the &.
Best regards
Mario Varchmin
http://www.e-llennium.de/e-llennium/index_en.htm
Subject: RE: Are you sure it is the &?
Thanks for the reply Mario.I did try the @Like command and I cannot seem to get it to work either. I think it must be the “&” and i wonder if there are any other characters that may cause problems eg “|”
Subject: RE: Are you sure it is the &?
Your problem is not with &. There’s something wrong with the way you’re constructing your search expression. Since you don’t show your code, but only the result you assume the code is producing, there’s no way to tell what’s wrong. I expect the value “SM&T” is actually coming from a variable. I would guess that you aren’t putting quotes around it inside the constant part of the string, or you’re including the variable name as part of the string instead of the value. It should be something like:
strQuery = {Form = “Issue” & I_Comp = “} & yourVar & {”}
This is of course assuming there are no quotes in yourVar’s value – if there are they would have to be escaped with a backslash.
I should also mention, that this is not a very good way to find documents. It may work OK in your test database, but as the number of documents in the application grows, this will become unacceptably slow. It’s much more efficient to use a view that either selects only the documents you want, or is sorted by the field you want to search by.