Custom search definition
Description
Specify the definition of the custom search bar
Discussion
If the Search bar type has been set to 'Custom Buttons', the labels and corresponding search expressions need to be defined.
For example:
A..C = upper(left({searchfield},1)) >= "A" .and. upper(left({searchfield},1)) <= "C" D..F = upper(left({searchfield},1)) >= "D" .and. upper(left({searchfield},1)) <= "F" G..I = upper(left({searchfield},1)) >= "G" .and. upper(left({searchfield},1)) <= "I" M..O = upper(left({searchfield},1)) >= "M" .and. upper(left({searchfield},1)) <= "O" P..R = upper(left({searchfield},1)) >= "P" .and. upper(left({searchfield},1)) <= "R" S..U = upper(left({searchfield},1)) >= "S" .and. upper(left({searchfield},1)) <= "U" V..X = upper(left({searchfield},1)) >= "V" .and. upper(left({searchfield},1)) <= "X" Y..Z = upper(left({searchfield},1)) >= "Y" .and. upper(left({searchfield},1)) <= "Z"
Syntax Rules
Enter the definition of the custom buttons below. Each button is defined on a single line using this syntax:
Button text=search expression
Where:
- Button text
The text you want to appear on the button. If you want to include an equal sign in the button text, you must escape the equal sign with a backslash. e.g. \=.
- search expression
The search expression to execute when the button is pressed. You can use the special placeholder {searchField} in the search expression. This will be replaced with field that you specify as the search field.
Database Search Syntax
If you are searching in a SQL database your search expression must use SQL syntax. If you are searching in a .dbf table, you must use Xbasic syntax.
Using Arguments in the Filter Expression and Using International Characters
You can use arguments in the filter expression using this syntax:
Button text = search expression && argumentValue|||argumentType|argumentName
For example:
A..C = left({searchfield},1) >= :arg1 AND left({searchfield},1) <= :arg1 && a|||c|arg1
The argument value can be an expression if you prefix it with an = sign. For example:
A..C = left({searchfield},1) >= :arg1 AND left({searchfield},1) <= :arg1 && ="a"|||c|arg1
In most cases you will not need to use an expression for the argument value. However, if you are using international characters, you will need to use the expression syntax to set the argument value to an international character.
For example, say you want to have a button that uses the Hebrew character (for example: ב). You cannot enter the Hebrew character directly for either the button label, or the argument value. Instead, you have to use the HTML encoded character (ב)as an argument in the *html_to_text() function.
For example:
ב = left({searchfield},1) = :arg1 && =*html_to_text("ב")|||c|arg1
See Also