I want to create a query where the user puts in a search string to find all records containing that search string.
I've used :SearchString as parameter, but when I add wildcards it must treat the parameter as a field as it no longer asks for the parameter value.
The GUI adds apostophes creating 'LIKE %:SearchString%'
Does anyone know how to get around this problem?
[Solved] Queries with Parameter & Wildcard
[Solved] Queries with Parameter & Wildcard
Last edited by Ant on Wed Nov 05, 2008 12:16 am, edited 1 time in total.
OOo 3.0.X on Ms Windows XP + MS Windows Vista
Re: Queries with Parameter & Wildcard
Not possible by means of built-in methods. You've got to put the wild cards into the parameter to be substituted (or write a macro, but as far as I know from older version 2.0.x, parameter substitution by means of API methods fails too).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Queries with Parameter & Wildcard
Just as a follow-up . . . that is . . . for others reading this . . . I wanted to give a graphic example, and, hopefully, a written 'explanation' . . . for clarity.
With a "Parameter Query" . . . the user is 'prompted' to input a 'value' for the search criteria. This is accomplished by starting a 'prompt' on the Criterion line . . . with a semi-colon ( : ).
In the graphic below . . . you can see how this is done . . . with :Last_Name_Percent
Furthermore, the 'prompt' must be one word ( no spaces ) and will be presented to the user, in alphabetical order, when more than one prompt is included in a Query.
According to HSQL documentation http://www.hsqldb.org/doc/guide/ch09.ht ... on-section:
Resulting in the following display
I hope this is clear . . . well, at least as clear as mud. Please be sure to let me / us know.
Sliderule
Thanks to add [Solved] in your first post title (edit button) if your issue has been fixed / resolved.
With a "Parameter Query" . . . the user is 'prompted' to input a 'value' for the search criteria. This is accomplished by starting a 'prompt' on the Criterion line . . . with a semi-colon ( : ).
In the graphic below . . . you can see how this is done . . . with :Last_Name_Percent
Furthermore, the 'prompt' must be one word ( no spaces ) and will be presented to the user, in alphabetical order, when more than one prompt is included in a Query.
According to HSQL documentation http://www.hsqldb.org/doc/guide/ch09.ht ... on-section:
So, when entered:http://www.hsqldb.org/doc/guide/ch09.html#expression-section wrote:The LIKE keyword uses '%' to match any (including 0) number of characters, and '_' to match exactly one character. To search for '%' or '_' itself an escape character must also be specified using the ESCAPE clause. For example, if the backslash is the escaping character, '\%' and '\_' can be used to find the '%' and '_' characters themselves. For example, SELECT .... LIKE '\_%' ESCAPE '\' will find the strings beginning with an underscore.
- Jo% would find all occurrences where the field started with Jo
- %Jo% would find all occurrences where the field contained Jo anywhere in the field
- %Jo would find all occurrences where the field ended with Jo
Resulting in the following display
I hope this is clear . . . well, at least as clear as mud. Please be sure to let me / us know.
Sliderule
Thanks to add [Solved] in your first post title (edit button) if your issue has been fixed / resolved.