Attributes Query

When the “Attributes Query” module is first activated, it always retrieves the expression used in the last session. Therefore, if you press Apply you will see the map with the previously defined restrictions. However, the outcome (map) might not be the same. Notice that applying a spatial query or a grouping before applying the attributes restrictions does not produce the same outcome as if you do it on the reverse order.

The Query interface utilizes two logical operators .AND. e .OR., and the following comparison operators:

= equal to;
<> not equal to;
< less than;
> greater than;
<= less than or equal to; and
>= greater than or equal to.

 


Creating a Query Expression

To make it easier for the user, the "Attributes Query" window provides, besides the operators, two lists (Attributes and Values) and a field where you can see the expression which is being formulated (Logical Expression).

NOTE: If you want to see the values for a specific attribute, choose it form the list and press Show.

Performing Attributes Query:

The Attributes Query module is activated from the "Visualizing Objects" interface which shows a list with all object categories existent on the Information Layer (IL). It is recommended to have only one object category per IL. However, if there is more than one, you should double click on the one you wish to perform the query.

  1. Click on Edit on the " Visualizing Objects" window and select the option Attributes Query... . The dialog box "Attributes Query" is presented;
  2. select one attribute from the Attributes list;
  3. select an operator in the Operation list;
  4. click on Values Show. Observe that the values for the selected attribute will be presented in ascendant order;
  5. select a value from the list;
  6. elaborate the restriction using the other operators;
  7. click on Apply to obtain the results for the Query. If there is any inconsistency, the system shows a warning, otherwise the query is applied.

NOTE: Before executing the Query, it is possible to fix the equation, canceling the last input or the whole equation, by clicking on the Cancelbutton.

Canceling Query Equation Parameters:

  • Click on Cancel to annul the Query Equation commands built. Each time the user presses this button, the last value or operator of the query is removed.

Query Example

Observe a Query performed over the districts in the city of São Paulo , using the following expression:

CG000002->INCOME>= 5 .AND. CG000002->FAIRS = 2.

On the left side of "->" we have the name of the table and on the right side we have the attribute name belonging to this table. On the example above all Attributes belong to the CG000002 table and the Attributes areINCOME and FAIRS. The boolean operator .AND. restricts even more the condition since the result will depend on the districts satisfying both conditions.

The expression can be interpreted as follows: "which districts have the income greater than or equal to 5 and exactly 2 fairs". The outcome of this Query is shown on the figure below. This same result is also shown at the Table interface, where the objects that satisfy the query are highlighted.

cons0011.gif - 23085,0 K


Saving, Loading or Canceling a Query Expression

Every Query expression can be re-applied since it has been previously stored in disk.

Clicking on Save..., the window "Save Expression" is presented and the user must type in a name for the expression to be saved and then press Apply.

Clicking on Load..., the window "Load Expression" is presented and the user must choose the name of the expression he wishes to load and then press Apply.

See some more the details at saving and loading expressions.

 

See also:

Database Query
How to control Objects Visualization .
Spatial Query
Attributes Table.
Pointing and Photo Module.

Query Models.