Querying By Example (QBE)
A Query is a way to filter ONLYTHE DATA THE USER WOULD LIKE TO SEE by setting parameter examples.
QBE Expressions provide LandMark with examples of data to be selected.
Example: typing Smith in a [Name] field instructs LandMark to select any records with “Smith” as the data in the [Name] field. The implied field reference is to the current field.
- QBE expressions have an implied “AND” between fields. If, in the same query specifying “Smith” in the [Name] field, the user can also enter MO in a[State] field, the user is instructing SmartWare to select records in which [Name]equals “Smith” and [State] equals “MO”.
Helpful Hint: ALL TEXT FIELDS ARE CASE SENSTIVE. For best results when building a query match the case. Example: 1. Property Type: REAL (query must be all caps as well).
Relational Operators
- Relational operators express a relationship between two numeric or text items. When the user uses a relational operator to describe such a relationship the user is creating a logical expression. The relational operators are summarized in the following table.
IMPORTANT: To search for a value that is less than a negative number, always put a space between the less-than symbol (<) and the negative number.
Example: < -10 instructs LandMark to search for values that are less than -10.
If the user omits the space, LandMark interprets the expression as a replace action. In the -10 example, the values in the field will be replaced by the number 10.
This is also useful when searching for only active records. To make certain that only active records are found in a query, in the parcel status box a 1 must be placed or a >0 (greater than 0).
NOTE: It is only necessary to enclose text in quotation marks if there is a risk that the text might be interpreted as part of a calculation. To ensure that SmartWare is able to distinguish between text and a project variable name, always use full formula expressions with project variables (e.g., [] = varname).
Range Operator.
.. is a special relational operator,
- Used before a value— means “less than or equal to” the value
Example: ..10 —mean less than or equal to 10 - Used after a value— means “greater than or equal to” the value.
Example: The expression 5..10 means greater than or equal to 5 and less than or equal to 10. To search date range: 01/01/2020..12/31/2020 would search for the whole year of 2020
In date strings, matches any individual day, month, or year. In time strings, the asterisk matches any hour, minute, or second specifications. The question mark cannot be used in date or time strings.
Wildcard Dates
Wildcard dates are composed of the elements that can be used in custom date formats. For example, wildcard entry of Tuesday will select all records having “Tuesday” in the date field, even though the entry is in a format such as 05/04/2014. Legal combinations are as follows:
The /can be replaced by – or , or a space. The characters represented by m, d, and y can be numbers or *.
QBE Patterns.
QBE patterns are wildcard strings.
- The asterisk * matches any sequence of characters
Example: *Q will query anything that contains a Q in that field - ? matches one character
IMPORTANT: Because multiplication of date and time expressions is valid, quotation marks must enclose a date or time string that begins with an asterisk.
Numeric Operators
Numeric operators perform mathematical operations on numeric expressions. These operators are used only with numeric expressions or expressions returning numeric data. The LandMark numeric operators are summarized in the following table:
Post your comment on this topic.