Using a Query Prompt to Filter Data in a Text File Database |
Searching with a query prompt is similar to searching with any other kind of filter. You can use wildcard characters to refine your search. However, in the case of text file databases, you can "escape" certain special characters so that they are handled as simple characters in the query prompt filter.
"Escaping" simply refers to adding square bracket characters around a special character to specify that the character is handled as part of the search term.
For example, suppose that you have created the following query prompt for the "Name" field in a text file database:
Name Like ?NamePrompt
At print-time, when you enter John*
for the query prompt, any name that starts with "John" is matched. You might get search results such as the following:
John Berry
John Hancock
John Smith
However, if you actually want to find the entry "John*", where the asterisk is part of the search term, you will not want the asterisk to be treated as a wildcard. To accomplish this, you can "escape" the asterisk by enclosing it in square brackets. At print-time, you would enter John[*]
as the search term for the query prompt. When you do this, only entries that contain "John*" are matched.
If you need to search for a term that contains brackets, such as "MyText[1]", you must escape the first bracket so that it will be treated as a simple character. At print-time, you would enter MyText
[
[
]
1]
for the query prompt. You do not need to escape the second bracket.
Escaping is needed only when using LIKE
, NOT LIKE
, BEGINS WITH
, NOT BEGINS WITH
, ENDS WITH
, NOT ENDS WITH
, CONTAINS
, and NOT CONTAINS
.
Escaping is not needed, nor will it work, for other operators such as EQUALS
and NOT EQUALS
.
For more information about using filters, refer to Filtering Data.
Related Topics