Creates a new query.
Synopsis
- new_query [common options] [-t/ype/ record
type] [-f/ield name] * [-field
name] * [-or] [-and] [-filteropfield
name[value[value]]] [-s/how]
[-show_sql/-ss] [-show_fields/-sf] [-show_filter/-sfi]
[-ids] [-dbids] [-rep/lace] filterop
Description
Creates, runs, and saves queries. The
query is composed on the command line and can be run immediately or saved
for later use.
Options and arguments
- -t/ype record type
- The type of record to find. If no value is provided, the default record
type is used.
- filterop
- Filters to use to define search criteria. Possible options include:
- eq - equal to
- ne - not equal to
- lt - less than
- le - less than or equal to
- gt - greater than
- ge - greater than or equal to
- like - contains the value
- not_like - does not contain the value
- in - includes one of a set of values
- not_in - does not include any of a set of values
- null - field value is null
- not_null - field value is not null
- between - value falls within a range
- not_between - value does not fall within a range
- -f/ield name
- Alternate format for specifying fields to show. Use this format if the
field is the same name as a subcommand option.
- -or
- Type of filter "or" for the clauses of the query.
- -filterop field name [ value [ value ]]
- Format used to define the fields on in the query.
- -s/how
- Displays the constructed query without running the query.
- -show sql/-ss
- Displays the "sql" statement generated by the query.
- -show fields/-sf
- Displays the fields to be included in the Query Results.
- -show filter/-sfi
- Displays the filters defined for the query.
- -ids
- Displays only the record IDs in the Query Results.
- -dbids
- The internal database ID of the record to modify.
- -rep/lace
- Overwrites the existing query.
Examples
Create and run a query to
find all the severity 1 or 2 errors. The "id", "headline" and "severity" fields
are displayed in the results.
CQTOOL> new_query -id -headline -severity -in severity "1 2" "Public Queries/query1"
id Headline Severity
----- --------------- ----------------------------
SAMPL00000011 The foobar is broken 1-Critical
SAMPL00000021 The widget needs repair 1-Critical
SAMPL00000019 query does not work 1-Critical
SAMPL00000051 we need new features 2-High
Count: 4
− -------------------------------------------------
Create and run a query to find all the defects currently opened
by the user Tom. The "id" and "headline" fields are displayed in the results.
CQTOOL> new_query -eq State Opened -and -eq Owner Tom -id -headline "Public Queries/query2"
id Headline
SAMPL00000011 The foobar is broken
SAMPL00000021 The widget needs repair
Count: 2 -------------------------------------------
Create and run a query to find all the defects currently opened
by the user Tom and severity 1 errors. The "id" and "headline" fields are
displayed in the results.
CQTOOL> new_query ( -eq State Opened -and -eq Owner Tom ) -and ( -eq Severity 1-Critical -and -Project Classics ) -headline "Public Queries/query3"
id Headline
SAMPL00000011 The foobar is broken
Count: 1 -------------------------------------------