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 you have created the following query prompt for the "Name" field in a text file database:

Name Like ?NamePrompt

At print-time, entering John* for the query prompt will match any name starting with "John". You might get search results such as:

However, if you really 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. That would match only entries containing "John*".

If you need to search for a term that actually contains brackets, such as "MyText[1]", you need to escape the first bracket so 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 like EQUALS and NOT EQUALS.

For more information about using filters, refer to Filtering Data.

Rubriques connexes