Strings need some extra explanation. To implement flexible queries, Signsoft intelliBO offers some additional features, which are related to those of the String class.
| Method | Meaning |
|---|---|
| startsWith | The string has to start with the specified search criteria. |
| endsWith | The string has to end with the specified search criteria. |
| contains | The string has to contain the specified search criteria. |
| pattern | The search text is passed to the database system without modification. You can use the SQL placeholders "%" (any character, zero or more) or "_" (exactly one character). |
A Method uses dot notation for its first parameter, the other parameters are placed in an argument list, e.g. "lastName.startsWith(\"er\")".
| Function | Meaning |
|---|---|
| upper | The specified attribute will be converted into uppercase letters before making the comparison. The operation runs in the database. |
| lower | The specified attribute will be converted into lowercase letters before making the comparison. The operation runs in the database. |
A Function has only an argument list, e.g. "upper(lastName)".
| Operator | Meaning |
|---|---|
| like | The search text is passed to the database system without modification. You can use the SQL placeholders "%" (any character, zero or more) or "_" (exactly one character). |
A Operator is placed between arguments, e.g. "lastName like \"er%\"".
Using these functions, you could create queries like these:
// all persons with leading 'M' in last name
query.setFilter("lastName.startsWith('M')");
// all persons with trailing "er" in last name
query.setFilter("lastName.endsWith(\"er\")");
// all persons with 2nd character "e" in first name
query.setFilter("firstName.pattern(\"_e%\")");
Note that the string must be enclosed with quotation marks. By using quotation marks you can express blanks in strings. If you want to search for quotation marks within a string, please use a parameter for the search string.
The following example shows how to make a case-insensitive query for a specific firstname that starts with "MAS":
filter = "upper(firstName) like (\"MAS\")";