This documentation supports the 21.05 version of BMC Helix CMDB.To view an earlier version, select the version from the Product version menu

Graphical query builder overview


BMC Helix CMDB includes templates that configuration managers can use to create queries to search for CIs. Additionally, configuration managers can use the graphical query builder to create their own queries to search for CIs meeting a certain criteria.


The graphical query builder is shown in the following figure:

QueryBuilderUI.png

Example

Jonnie, a system administrator in Calbro Services wants to install patch 2.0 of an antivirus software on computers belonging to the Payroll department. He creates a query that looks up for all computers in the Payroll department that have the antivirus software installed on them, but not having the patch 2.0 of the software installed on them.

He can reuse this query later on by editing the patch details to install another patch on the same computers. He can also share this query with system administrators of other departments. They can edit the computer system class details to install this patch on computers in their department. 

This query includes the BMC_ComputerSystem CI class, the BMC_Component relationship class, the BMC_Application class, and the BMC_Patch class.

For each class, Jonnie can create one or more query conditions based on the attributes of that class. For example, a query for computer systems might include several conditions for the BMC_ComputerSystem class ( Name, Department attributes) and other conditions for the BMC_Patch class ( PatchNumber attribute).


Personal and shared queriesPersonal Query — You can save a query as a personal query and use it later on.  

Shared Query —  You can save a query as a shared query and share with other users.  

For more information about the roles, see Providing-users-with-permissions-to-access-the-CMDB-Portal-by-using-groups-and-roles.

User type permissions

 The following table describes the permissions available to different user types to perform various tasks related to creating and editing a search query.

User type

Can build a search query?

Can search for CIs using a query?

Can save a search query?

Can edit a search query?

Can delete a search query?

CMDB consumer

Yes

Yes

No

No

No

CMDB Data publisher

Yes

Yes

Yes

Yes

Yes

Configuration manager

Yes

Yes

Yes

Yes

Yes


CardinalityEvery relationship class has a cardinality that defines the number of instances of the source class that can be related to each instance of the destination class. While creating a query, you can set conditions on the number of related items that must be present for the result to be returned. The minimum and maximum numbers specify a minimum and a maximum range of the number of destination CIs that are connected to the source CI for which you want to run the search query. 

Cardinality1.png

By default, the Required checkbox is selected, which means that the child or destination class is a required class in the search results.

For example, if your search query contains a Computer system class that is connected to an Application class and the Required check box is selected, then the search query returns only those computer systems that have at least one application class connected to it. 

But there may be some scenarios where you may not want to specify the cardinality.

For example, as a system administrator you want to install the latest version of the antivirus software on a specific group of computers. Therefore, you  want to create a search query that will return a list of not only all computers that have an older version of the antivirus software installed but also those computers that don't have an antivirus software installed at all. In this case, while creating a relationship between the Computer system class and the Application class, you must clear the Required check box.

Cardinality3.png

You can specify the minimum and maximum instances of the child class that must be returned in the search query results. 

If you do not select the Specify value check box, the maximum value is unrestricted.

If you select the Specify value check box, you can specify a maximum value for the cardinality.

Cardinality2.png


The following table describes the cardinality values in detail. This table describes an example of a computer system class that is connected to one or more application classes.

Cardinality values

Explanation

Unrestricted (1 to *)

Each instance of the source class is related to one or more instances of the destination class. For example, if you query a computer system related to many applications, the query returns computer systems with at least one application.

Minimum 2 and maximum 4

If you specify a minimum value as 2 and maximum value as 4, it means that each instance of the source class must be related to at least two instances and up to four instances of the destination class. The query returns only computer systems that have between two and four applications.

Minimum 1 and Maximum 1

If you specify a minimum value as 1 and maximum value as 1, it means that each instance of the source class must be related to just one instance of the destination class. For example, if you query one computer system to one application class, the query returns only those computer systems that have one and only one application.