This documentation supports the 19.08 version of BMC CMDB.

To view an earlier version, select the version from the Product version menu.

Searching for CIs using a custom query in advanced search




You can create custom queries to search for configuration items (CIs) by specifying criteria such as the related class of the CI, specific attribute values of each class, and the relationship that the two related classes share.


This image shows the location of the custom search option

The following video shows an example of how you can create a custom query:

 https://youtu.be/43KYCqXj0Qs

The example search shown in the video shows you how to create a custom query for a computer by entering the following criteria in the query builder:

FieldValue
Category'Hardware'
Normalization status'Not Normalized'
Reconciliation IDID with a nonzero value
ManufacturerDell


BMC CMDB builds the following search query for this example:

BMC.CORE:BMC_ComputerSystem, qualification = 'Category' = "Hardware" AND (('NormalizationStatus' = "Not Normalized") OR ('ReconciliationIdentity' != 0)) related to :BMC.CORE:BMC_NetworkPort, qualification = 'ManufacturerName' = "Dell"

Search operators, keywords, and wildcards

You need various operators, keywords, and wildcards to build a search query. The following information helps you understand the usage of operators, keywords, and wildcards.

Operators

The operators match specified attributes to specific values.  


OperatorActionExample query and results
=

Matches contents that are exactly equal to the value.


'Status'=0 finds all requests with a status value equal to zero.
<

Matches contents that are less than the value.


'CreateDate'<($DATE$-86400) finds all requests created more than 24 hours ago (where 86400 is the number of seconds in 24 hours).
>

Matches contents that are greater than the value.

'CreateDate'>"10/31/05 00:00:00" finds all requests created after midnight on October 31, 2005.
!=Matches contents that are not equal to the numeric or a string.Not provided.
>=

Matches contents that are greater than or equal to the value.

'CreateDate'>="10/31/05" finds all requests created on or after October 31, 2005.
<=

Matches contents that are less than or equal to the value.

For a class BMC_Person, 'Salary'<=10000 finds all requests with contents of the Salary field less than or equal to 10000.
()Use these parentheses to create groups or to specify the order in which the operations are to be performed.Not provided.
+

Adds two integer, real, or decimal values. Adds an integer, real, or decimal interval to a time value. Real and decimal values are truncated to an integer value. Concatenates two character strings.

'CreateDate'>$DATE$+28800 finds all requests created after 8:00 A.M. today (where 28800 is the number of seconds in 8 hours).
-

Performs any of the following calculations:
• Subtracts two integer, real, or decimal values.
• Subtracts two time values. Result is an integer.
• Subtracts an integer, real, or decimal interval from a time value. Real and decimal values are truncated to an integer value.

'Create Date'>$DATE$-604800 finds all requests created within the last seven days. 604800 is the number of seconds in one week.
*

Multiplies two integer, real, or decimal values.

'Quantity' * 'Price'>50 finds all requests where the contents of the Quantity field multiplied by the contents of the Price field is more than 50.
/

Divides two integer, real, or decimal values.

For example, 'Yearly Expenses'/12>8000 finds all requests where the average monthly expense is greater than $8,000.


"

Enclose strings and dates when you create your query in the Build Qualification dialog box.

To search for all requests created after a certain date, use 'CreateDate' > "04/01/04".
If you want to search for a string such as: Robert "Bobby" Smith, enter: "Robert ""Bobby"" Smith"
'Single quotation marks are automatically added when you select attributes.Not provided.
$

The dollar signs ($) on either side of a keyword signify the value assigned to the keyword.

$Date$ returns today's date in UNIX time, that is, the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.
AND

Logical AND of the result of two conditions. The result is true if both conditions are true.

Not provided.
OR

Logical OR of the result of two conditions. The result is true if one of the conditions is true.

Not provided.
NOT

Negates the condition that follows. If the condition is false, the result is true.

NOT 'Status'="New" finds all requests that are not new. You can use the symbol ! instead of the word NOT.
LIKE

Performs a pattern search using wildcard characters.

'Submitter' LIKE "Bob%ton" finds all requests with a submitter name that begins with the letters "Bob" and ends with the letters "ton", such as Bob Compton and Bobby Fenton.
%

Matches any string of zero or more characters.

Example: J%son matches Jackson, Johnson, Jason, and Json. To include leading and trailing characters, you must use the % symbol. To match Jill Bobbington, Bobby Fenton, Bob Compton, and Bob Stone you can enter "%Bob%ton%"

Keywords

Keywords return or represent defined values.

KeywordAction
USERThe current user login. A "user" can refer to either a human user or an internal (system) user.  An internal user can be an escalation "user" (AR_ESCALATOR user), a DSO action (Distributed Server user), or an application binary (such as Remedy Application Service user).
DATE

For date or time fields, this keyword evaluates to the current date, and the time is set to midnight by default. Anything stored in a date or time field is stored as the number of seconds since UNIX time, which includes the date and time.

UNIX time (also known as POSIX time or UNIX Epoch time) is a system for describing a point in time, defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.

Note: When using $DATE$ in a search on a Date or Time field, you can add or subtract date/time by using a value that is based on seconds. For example: dateTimeField> $DATE$ - 86400 (86400 is the number of seconds in 24 hours.) For Date fields, this keyword evaluates to the current date. For Time fields, this keyword evaluates to 12:00:00 AM.

Note: The $DATE$ keyword is not expanded when default values are set. This allows the value to be set to the date the form is submitted rather than the date the form is opened.
TODAY

Today's date in UNIX time.

NULL

A null value (no value).

BMC CMDB treats a NULL value as follows:
• Character, Diary, Timestamp, Selection — An empty string
• Integer, Real, Decimal — A value of 0

Operator precedence

When you use multiple operators to create qualification criteria, they are evaluated in the following order:

  1. ( )
  2. NOT (!) - (unary minus; an operator that takes only one operand; for example, -2.5)
  3. / % *
  4. + -
  5. < <= > >= !- LIKE
  6. AND 
  7. OR

Operators of the same precedence are performed left to right. 

You can use parentheses in an expression to override operator precedence. BMC CMDB evaluates expressions inside the parentheses first before evaluating those outside the parantheses.

Resources

More about Unix Epoch Time

Convert to Epoch time

Was this page helpful? Yes No Submitting... Thank you

Comments