Parentheses in compound queries
You can use the Query Builder to make precise queries containing as many rules as necessary to identify the appropriate virtual machines. In a query such as powerstate Equal "poweredOn", the result of the query is easy to predict: only the virtual machines that are turned on are included in the backup. But if several rules are combined with AND and OR, the result may not be obvious. This kind of query is called a compound query. Compound queries contain two or more rules, joined by AND, AND NOT, OR, or OR NOT.
The order in which the Query Builder evaluates compound rules affects the outcome of the query. Grouping the rules with parentheses can change the order of evaluation and thus the outcome of the query.
The examples in the following table demonstrate how the Query Builder evaluates compound queries with and without parentheses.
Note:
Only the Query Builder's Advanced Mode supports the use of parentheses.
Table: Examples of compound queries with and without parentheses
Example query | The following virtual machines are selected |
|---|---|
ESXServer Equal "ESX001" OR Folder Equal "FolderEngA" AND powerstate Equal ON | All virtual machines under ESX001 (regardless of power state), and virtual machines under FolderEngA that are turned on To select only the virtual machines that are turned on in the ESX server and in the folder, use parentheses (see next example). |
(ESXServer Equal "ESX001" OR Folder Equal "FolderEngA") AND powerstate Equal ON | All the virtual machines that are turned on in ESX001 and in FolderEngA. |