View Full Version : OPNQRYF %WLDCRD problem
mvictor@cms400.com
01-01-1995, 02:00 AM
Hello, I have an application in which the user is prompted to enter search strings. I then use these search strings to search descriptions in a database file. The user is then presented with a list of matching records which he/she can then select. I have used OPNQRYF with the %WLDCRD option to search for the records similar to the following: ...QRYSLT('DESC *EQ %WLDCRD("*TEXT*")') Everything runs fine unless the user types in a double quote("). In one particular case the user is searching for a 2" spring, and when I build the command, it ends up looking like the following: ...QRYSLT('DESC *EQ %WLDCRD("*2" spring*")') Is there a way in which I can have the quote which the user typed, treated as part of the search string and not as part of the syntax of the %WLDCRD function?
J.Pluta
11-06-2000, 11:19 AM
Did you try doubling the double quote? I'm not sure if it will work, but that's one of the two typical ways of handling quotes inside of quoted strings. Try something like: QRYSLT('DESC *EQ %WLDCRD("*2"" spring*")') Joe http://www.java400.net http://www.edeployment.com http://www.plutabrothers.com
J.Pluta
11-06-2000, 11:29 AM
Another option would be to use single quotes around the wildcard contents, but that would run into the same difficulty if someone tried to enter a single quote in the search string. But if you want to try it, you can do it as follows: <code>QRYSLT('DESC *EQ %WLDCRD(''*2" spring*'')')</code> Note the doubled-up single quotes - that's because the single quote surrounding the wildcard search value is inside the single quotes of the QRYSLT variable. This can get very confusing very quickly. Joe
mvictor@cms400.com
11-06-2000, 11:41 AM
Yep, doubling up the quotes seems to work. I guess I now have to scan the search strings for any " and replace them with ""...oh the fun never stops. Thanks for the speedy responses.
J.Pluta
11-06-2000, 11:57 AM
Yep, doubling up the quotes seems to work. I guess I now have to scan the search strings for any " and replace them with ""...oh the fun never stops. Thanks for the speedy responses. Ah, welcome to the exciting world of text manipulation <grin>. Yeah, searching for and handling escape sequences is the bugaboo of all kinds of text-based processing. I had to put in special code to handled unbalanced parentheses in my CPYSPLFPDF, and it really whomped performance. But I'm glad I could "help" <smile>. Joe http://www.java400.net http://www.edeployment.com http://www.plutabrothers.com
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.